Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to determine request content type/media type? #73

Closed
sigmanil opened this issue Aug 21, 2020 · 4 comments
Closed

Is there a way to determine request content type/media type? #73

sigmanil opened this issue Aug 21, 2020 · 4 comments

Comments

@sigmanil
Copy link

I can't seem to figure out how to specify that an incoming post body, with "String" as the body type, should be something like "text/plain; charset=utf-8" instead of application/json.

@sigmanil
Copy link
Author

sigmanil commented Aug 21, 2020

Using BinaryRequest in the following way, and then using the data class as the input, seems to work:

const val contentType = "text/plain; charset=utf-8"
@BinaryRequest([contentType])
data class ImportParam(val stream: InputStream)

Is that the intended use? (Just confused because of the "binary" in the name.)

@Wicpar
Copy link
Collaborator

Wicpar commented Aug 22, 2020

These things are handled by the BodyParser and ResponseSerializer, there is none for plain text, but you can create your own.
Copying BinaryContentTypeParser would be a good start.

@Wicpar
Copy link
Collaborator

Wicpar commented Aug 22, 2020

just make sure the module is registered in the context or the annotations won't work.

@Wicpar
Copy link
Collaborator

Wicpar commented Sep 15, 2020

Since there is a solution and no further questions i am closing the issue.

@Wicpar Wicpar closed this as completed Sep 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants