Created
October 12, 2016 23:59
-
-
Save preetamtt/cdf2e114362a07e2a560abb093ac82f5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
200 OK case: | |
(venv) preetam-mac:python preetam$ curl -v -X POST --data-binary @post_body localhost:3000/get-price | |
* Trying ::1... | |
* Connected to localhost (::1) port 3000 (#0) | |
> POST /get-price HTTP/1.1 | |
> Host: localhost:3000 | |
> User-Agent: curl/7.43.0 | |
> Accept: */* | |
> Content-Length: 3664 | |
> Content-Type: application/x-www-form-urlencoded | |
> Expect: 100-continue | |
> | |
< HTTP/1.1 100 Continue | |
* We are completely uploaded and fine | |
< HTTP/1.1 200 OK | |
< Date: Wed, 12 Oct 2016 23:56:49 GMT | |
< Content-Length: 71 | |
< Content-Type: text/plain; charset=utf-8 | |
< | |
* Connection #0 to host localhost left intact | |
{"base_price":2,"base_price_instant":7,"base_price_customer_contact":7} | |
500 Case: | |
curl -v -X POST --data-binary @500_request localhost:3000/get-price | |
* Trying ::1... | |
* Connected to localhost (::1) port 3000 (#0) | |
> POST /get-price HTTP/1.1 | |
> Host: localhost:3000 | |
> User-Agent: curl/7.43.0 | |
> Accept: */* | |
> Content-Length: 144 | |
> Content-Type: application/x-www-form-urlencoded | |
> | |
* upload completely sent off: 144 out of 144 bytes | |
< HTTP/1.1 500 Internal Server Error | |
< Content-Type: text/plain; charset=utf-8 | |
< X-Content-Type-Options: nosniff | |
< Date: Wed, 12 Oct 2016 23:57:26 GMT | |
< Content-Length: 64 | |
< | |
{"error_code":500,"message":"Failed to determine credit price"} | |
where the post body is: | |
{ | |
"id":6, | |
"category_id": -1, | |
"zip": "94109", | |
"to_customer": true, | |
"to_pro": false, | |
"dist": 12, | |
"remote": false | |
} | |
400 Bad request case: | |
curl -v -X POST --data-binary '{}' localhost:3000/get-price | |
* Trying ::1... | |
* Connected to localhost (::1) port 3000 (#0) | |
> POST /get-price HTTP/1.1 | |
> Host: localhost:3000 | |
> User-Agent: curl/7.43.0 | |
> Accept: */* | |
> Content-Length: 2 | |
> Content-Type: application/x-www-form-urlencoded | |
> | |
* upload completely sent off: 2 out of 2 bytes | |
< HTTP/1.1 400 Bad Request | |
< Content-Type: text/plain; charset=utf-8 | |
< X-Content-Type-Options: nosniff | |
< Date: Wed, 12 Oct 2016 23:59:12 GMT | |
< Content-Length: 56 | |
< | |
{"error_code":400,"message":"Invalid request received"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment