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

Multipart form with JSON returned as JSON string #693

Open
TristanSpeakEasy opened this issue Feb 9, 2023 · 0 comments
Open

Multipart form with JSON returned as JSON string #693

TristanSpeakEasy opened this issue Feb 9, 2023 · 0 comments

Comments

@TristanSpeakEasy
Copy link

TristanSpeakEasy commented Feb 9, 2023

Would be great if when uploading JSON as one of the multipart form fields, if it has a Content-Type header application/json then in the returned form object the JSON is decoded instead of returning a JSON string for the field

current behaviour:

{
  "args": {}, 
  "data": "", 
  "files": {}, 
  "form": {
    "arr": "[{\"any\":\"\\\"any\\\"\",\"bool\":true,\"bytes\":\"bytes\",\"date\":\"2020-01-01\",\"dateTime\":\"2020-01-01T00:00:00.000001+00:00\",\"enum\":\"one\",\"float32\":1.1,\"int\":1,\"int32\":1,\"num\":1.1,\"str\":\"test\"},{\"any\":\"\\\"any\\\"\",\"bool\":true,\"bytes\":\"bytes\",\"date\":\"2020-01-01\",\"dateTime\":\"2020-01-01T00:00:00.000001+00:00\",\"enum\":\"one\",\"float32\":1.1,\"int\":1,\"int32\":1,\"num\":1.1,\"str\":\"test\"}]", 
    "bool": "true", 
    "int": "1", 
    "map": "{\"key\":{\"any\":\"\\\"any\\\"\",\"bool\":true,\"bytes\":\"bytes\",\"date\":\"2020-01-01\",\"dateTime\":\"2020-01-01T00:00:00.000001+00:00\",\"enum\":\"one\",\"float32\":1.1,\"int\":1,\"int32\":1,\"num\":1.1,\"str\":\"test\"}}", 
    "num": "1.1", 
    "obj": "{\"any\":\"\\\"any\\\"\",\"bool\":true,\"bytes\":\"bytes\",\"date\":\"2020-01-01\",\"dateTime\":\"2020-01-01T00:00:00.000001+00:00\",\"enum\":\"one\",\"float32\":1.1,\"int\":1,\"int32\":1,\"num\":1.1,\"str\":\"test\"}", 
    "str": "test"
  }, 
  "headers": {
    "Content-Length": "1665", 
    "Content-Type": "multipart/form-data; boundary=40909f5f5ba6d7c5a097a61c38f9b8600483f0f2", 
    "Host": "localhost:35123", 
    "User-Agent": "GuzzleHttp/7"
  }, 
  "json": null, 
  "method": "PUT", 
  "origin": "172.18.0.1", 
  "url": "http://localhost:35123/anything/requestBodies/put/multipart/deep"
}

expected:

{
  "args": {}, 
  "data": "", 
  "files": {}, 
  "form": {
    "arr": [{"any":"\"any\"","bool":true,"bytes":"bytes","date":"2020-01-01","dateTime":"2020-01-01T00:00:00.000001+00:00","enum":"one","float32":1.1,"int":1,"int32":1,"num":1.1,"str":"test"},{"any":"\"any\"","bool":true,"bytes":"bytes","date":"2020-01-01","dateTime":"2020-01-01T00:00:00.000001+00:00","enum":"one","float32":1.1,"int":1,"int32":1,"num":1.1,"str":"test"}], 
    "bool": "true", 
    "int": "1", 
    "map": {"key":{"any":"\"any\"","bool":true,"bytes":"bytes","date":"2020-01-01","dateTime":"2020-01-01T00:00:00.000001+00:00","enum":"one","float32":1.1,"int":1,"int32":1,"num":1.1,"str":"test"}}, 
    "num": "1.1", 
    "obj": {"any":"\"any\"","bool":true,"bytes":"bytes","date":"2020-01-01","dateTime":"2020-01-01T00:00:00.000001+00:00","enum":"one","float32":1.1,"int":1,"int32":1,"num":1.1,"str":"test"}, 
    "str": "test"
  }, 
  "headers": {
    "Content-Length": "1665", 
    "Content-Type": "multipart/form-data; boundary=40909f5f5ba6d7c5a097a61c38f9b8600483f0f2", 
    "Host": "localhost:35123", 
    "User-Agent": "GuzzleHttp/7"
  }, 
  "json": null, 
  "method": "PUT", 
  "origin": "172.18.0.1", 
  "url": "http://localhost:35123/anything/requestBodies/put/multipart/deep"
}
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

1 participant