int128 / gpup

A command to upload photos and movies to Google Photos Library using the official Google Photos Library API
Apache License 2.0
221 stars 22 forks source link

Improve HTTP debug log #9

Closed int128 closed 6 years ago

int128 commented 6 years ago

This changes format of HTTP debug log and adds OAuth HTTP log.

For example,

2018/09/14 09:55:19 [REQUEST] POST https://photoslibrary.googleapis.com/v1/uploads
POST /v1/uploads HTTP/1.1
Host: photoslibrary.googleapis.com
User-Agent: Go-http-client/1.1
Content-Length: 0
X-Goog-Upload-File-Name: ...
X-Goog-Upload-Protocol: raw
Accept-Encoding: gzip

2018/09/14 09:55:19 [REQUEST] POST https://accounts.google.com/o/oauth2/token
POST /o/oauth2/token HTTP/1.1
Host: accounts.google.com
User-Agent: Go-http-client/1.1
Content-Length: 229
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip

2018/09/14 09:55:20 [RESPONSE] POST https://accounts.google.com/o/oauth2/token
HTTP/2.0 200 OK
Alt-Svc: quic=":443"; ma=2592000; v="44,43,39,35"
Cache-Control: private
Content-Type: application/json; charset=utf-8
Date: Fri, 14 Sep 2018 00:55:20 GMT
Server: ESF
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 1; mode=block

2018/09/14 09:55:20 [REQUEST] POST https://photoslibrary.googleapis.com/v1/uploads
POST /v1/uploads HTTP/1.1
Host: photoslibrary.googleapis.com
User-Agent: Go-http-client/1.1
Content-Length: 0
Authorization: Bearer ...
X-Goog-Upload-File-Name: ...
X-Goog-Upload-Protocol: raw
Accept-Encoding: gzip