Skip to content

Strict server generates error for text/plain response types #2076

@mtandersson

Description

@mtandersson

When generating strict server using version 2.5.0 and respons type of text/plain the generated code looks something like this (for echo):

type InternalServerErrorTextResponse string

type DeleteRequest500TextResponse struct {
	InternalServerErrorTextResponse
}

func (response DeleteRequest500TextResponse) VisitDeleteRequestResponse(w http.ResponseWriter) error {
	w.Header().Set("Content-Type", "text/plain")
	w.WriteHeader(500)

	_, err := w.Write([]byte(response))
	return err
}

This does not compile with an error cannot convert response (variable of struct type DeleteRequest500TextResponse) to type []byte

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions