Multipart form with JSON returned as JSON string
TristanSpeakEasy opened this issue · 0 comments
TristanSpeakEasy commented
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"
}