0

All. Thanks in advance. I have simple web api in c#. it returns data correctly now. when I test it with postman, it returns "application/json". But when i consume it with modernhttpclient in xamarin, it tells me "multipart form data". Is anybody know how to fix it? Is this api problem or xamarin problem? Thanks

  • https://stackoverflow.com/questions/4238809/example-of-multipart-form-data – Greg Feb 01 '18 at 19:17
  • Content type is negotiated by request headers. This is useful to read about WebAPI: https://learn.microsoft.com/en-us/aspnet/web-api/overview/formats-and-model-binding/content-negotiation – trailmax Feb 01 '18 at 19:20
  • hi, Greg, thanks for your reply. – Rock James Feb 01 '18 at 19:20
  • --MultipartDataMediaFormatterBoundary1q2w3e Content-Disposition: form-data; name="MSG" duplicate --MultipartDataMediaFormatterBoundary1q2w3e Content-Disposition: form-data; name="RESULT" False --MultipartDataMediaFormatterBoundary1q2w3e-- it is the result from .net web api. but post man shows me json. Problem is response content type is multipart form data. but in post man, it is "application/json". – Rock James Feb 01 '18 at 19:28
  • Show us the code please – Idev Dev Feb 02 '18 at 10:05
  • [HttpPost] public async Task GetResult(RequestModel model) { – Rock James Feb 03 '18 at 10:44
  • public Task GetResult(RequestModel model) { ResponseModel model = new ResponseModel(){ID = 1, NAME="a"} return Ok(model); } – Rock James Feb 03 '18 at 10:46
  • My code is extremely easy one but response is Multipart-form data. – Rock James Feb 03 '18 at 10:47

0 Answers0