Skip to content

[BUG] PHP client cannot post model (json) #657

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

Closed
wing328 opened this issue Apr 17, 2015 · 1 comment
Closed

[BUG] PHP client cannot post model (json) #657

wing328 opened this issue Apr 17, 2015 · 1 comment

Comments

@wing328
Copy link
Contributor

wing328 commented Apr 17, 2015

Tested with the latest PHP client (SwaggerClient) and it failed to post model (addPet). tcpdump shows that it interrupts the model (json) as multi-form parameters:

POST /v2/pet HTTP/1.1
User-Agent: PHP-Swagger
Host: petstore.swagger.io
Accept: application/json, application/xml
Content-Length: 632
Expect: 100-continue
Content-Type: application/json; boundary=------------------------00c9a929dcb67f70
{P6E
Qw(?
{66E
Qw(?
HTTP/1.1 100 Continue
Qw(`=
Qw(`=
--------------------------00c9a929dcb67f70
Content-Disposition: form-data; name="id"
10005
--------------------------00c9a929dcb67f70
Content-Disposition: form-data; name="category"
--------------------------00c9a929dcb67f70
Content-Disposition: form-data; name="name"
PHP Unit Test
--------------------------00c9a929dcb67f70
Content-Disposition: form-data; name="photo_urls"
--------------------------00c9a929dcb67f70
Content-Disposition: form-data; name="tags"
--------------------------00c9a929dcb67f70
Content-Disposition: form-data; name="status"
--------------------------00c9a929dcb67f70--
,THTTP/1.1 400 Bad Request
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, DELETE, PUT
Access-Control-Allow-Headers: Content-Type, api_key, Authorization
Content-Type: application/json
Connection: close
Server: Jetty(9.2.7.v20150116)
{"code":400,"type":"unknown","message":"bad input"}

Form POST (updatePetWithForm) request looks good with the correct content-type and body

POST /v2/pet/10005 HTTP/1.1
User-Agent: PHP-Swagger
Host: petstore.swagger.io
Accept: application/json, application/xml
Content-Type: application/x-www-form-urlencoded
Content-Length: 29
name=test%251&status=test%252

I'll try to fix the issues and add some test cases to cover both POST form and model (JSON)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants