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

Application/octet-stream is set as mediaType when uploading json file payload using form parameters instead of application/json #4834

Closed
tejas-ambekar opened this issue Aug 4, 2021 · 0 comments · Fixed by #4877
Milestone

Comments

@tejas-ambekar
Copy link

I am using jersey implementation for creating a REST service and trying to upload .json file to the server using form parameters. I am creating a FileDataBodyPart object and passing it to object of FormDataMultiPart.

FileDataBodyPart fileBodyPart = new FileDataBodyPart(name, file); form.bodyPart(fileBodyPart);

The default MediaType that is getting set here is application/octet-stream. I looked at jersey library code, it internally "decides" which mediatype to set. If the file type is not in the list of CommonMediaTypes then it sets it as octect-stream.

public static MediaType getMediaTypeFromFileName(final String fileName) {

The above URL points to the jersey code which lists available mediatypes. application/json is not in the list of supported formats.

I wanted to know if there is a specific reason for not supporting the json format by jersey library? Or The support for application/json is added in more recent versions of jersey for multipart file upload.

@jansupol jansupol closed this as completed Oct 6, 2021
@jansupol jansupol added this to the 3.1.0 milestone Oct 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants