kr / hk

Fast Heroku client
https://hk.heroku.com/
77 stars 6 forks source link

Use HKDEBUG to dump full requests and responses. #87

Closed bgentry closed 10 years ago

bgentry commented 10 years ago

Replaces HKDUMPREQ.

$ HKDEBUG=1 ./hk create omgwtfbbq
POST /apps HTTP/1.1
Host: api.heroku.com
User-Agent: hk dev darwin amd64
Content-Length: 20
Accept: application/vnd.heroku+json; version=3
Authorization: Basic CREDS
Content-Type: application/json
Accept-Encoding: gzip

{"name":"omgwtfbbq"}
HTTP/1.1 422 Unprocessable Entity
Content-Length: -1
Connection: keep-alive
Content-Type: application/json;charset=utf-8
Date: Wed, 16 Oct 2013 21:28:35 GMT
Oauth-Scope: global
Oauth-Scope-Accepted: global write write-protected
Ratelimit-Remaining: 2399
Request-Id: 367ea525-7a02-4e4f-9102-abcd12345678
Server: nginx/1.2.8
Status: 422 Unprocessable Entity
Vary: Accept-Encoding
X-Content-Type-Options: nosniff
X-Runtime: 0.066401904

{"id":"invalid_params","message":"Name is already taken"}
Unexpected error: 422 Unprocessable Entity

Thinking about adding spacing or a separator between the request & response for better readability.

kr commented 10 years ago

Looks reasonable.

An extra blank line after the request seems fine to me.

This commit should also update hk help environ to reflect the new behavior.

bgentry commented 10 years ago

Cool, I just fixed the help and added the newline as well. Merging!