3

I am working on an application with graphQL and spring boot framework. Here I am using GraphQL's Schema-first approach to write my schema details. In my scenario, I need to update the user profile image using GraphQL. I am using my test client as postman and I have attached the mock request structure as well. When I send my mock data to the server, I am receiving '415 - Unsupported Media Type' error response. Can someone please guide me on this. ?

Also, please suggest if I have to use multipart file to get the uploaded file at the server.

Thanks in advance. File upload details from postman

swanthri
  • 79
  • 1
  • 7
  • multipart ok, check jpg file? – xadm Sep 22 '20 at 09:07
  • @xadm - I guess, File type won't be an issue in this case. – swanthri Sep 23 '20 at 11:11
  • guess vs check ... error claims it can be – xadm Sep 23 '20 at 11:21
  • @xadm - I tried with jpg and other doc files as well, but still I am getting the same issue. The below trace is logged in the IDE. [org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'multipart/form-data;boundary=--------------------------475496141779473820894541' not supported] – swanthri Oct 20 '20 at 12:34
  • does this server support graphql uploads ? https://github.com/jaydenseric/graphql-multipart-request-spec – xadm Oct 20 '20 at 12:59
  • @xadm - We can upload a file using GraphQL and I have followed the same way as given in the above GitHub source to send my request. I have referred to the below link to upload a file using GraphQL. When I send the request from the Postman client, I am getting a '415-unsupported Media Type'. https://stackoverflow.com/questions/57372259/how-to-upload-files-with-graphql-java – swanthri Oct 20 '20 at 15:43
  • @xadm - I could able to fix this issue, There was some configuration issue which was blocking the file upload from the code before the request reaches the corresponding API. I have re-worked on the configuration and now it is working...!Thanks..! – swanthri Oct 28 '20 at 11:08
  • 1
    hmmm, 415 should tell us this earlier ... graphql error response is always 200 (if not fatal 500) – xadm Oct 28 '20 at 11:47

0 Answers0