Skip to content

ContentType does not return charset when using the default encoder #3843

@james-haan

Description

@james-haan

Expected this to return the appended charset,

Response(StatusOK, func() {
	ContentType("application/json; charset=utf-8")
})

but got this instead.

< HTTP/1.1 200 OK
< Content-Type: application/json

Found the code which was overriding the original content type to be the parsed mime type.
However I was curious if this was intended(by making the user to implement a custom encoder).

SetContentType(w, mt)

I changed the code to ct which is provided from the dsl and returns the wanted charset.

< HTTP/1.1 200 OK
< Content-Type: application/json; charset=utf-8

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions