minio / mc

Unix like utilities for object store
https://min.io/download
GNU Affero General Public License v3.0
2.86k stars 548 forks source link

support: --debug flag will print http requests for easier debugging #4776

Closed vadmeste closed 10 months ago

vadmeste commented 11 months ago

Community Contribution License

All community contributions in this pull request are licensed to the project maintainers under the terms of the [Apache 2 license] (https://www.apache.org/licenses/LICENSE-2.0). By creating this pull request I represent that I have the right to license the contributions to the project maintainers under the Apache 2 license.

Description

This PR is not tested yet; this requires the help of @anjalshireesh to set up a local environment

Motivation and Context

How to test this PR?

Types of changes

Checklist:

shtripat commented 11 months ago

It shows details as below in a local deployment

---------START-HTTP---------
HEAD / HTTP/1.1
Host: localhost:9000
User-Agent: Go-http-client/1.1
Content-Type: application/json

HTTP/1.1 200 OK
Content-Length: 3035
Accept-Ranges: bytes
Content-Security-Policy-Report-Only: default-src 'self'; script-src 'self' https://js.chargebee.com https://js.stripe.com; frame-ancestors 'self'
Content-Type: text/html
Date: Wed, 29 Nov 2023 10:52:41 GMT
Last-Modified: Wed, 29 Nov 2023 05:29:50 GMT
Server: routerapp
Vary: Accept-Encoding
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
---------END-HTTP---------
anjalshireesh commented 11 months ago

It shows details as below in a local deployment

---------START-HTTP---------
HEAD / HTTP/1.1
Host: localhost:9000
User-Agent: Go-http-client/1.1
Content-Type: application/json

HTTP/1.1 200 OK
Content-Length: 3035
Accept-Ranges: bytes
Content-Security-Policy-Report-Only: default-src 'self'; script-src 'self' https://js.chargebee.com https://js.stripe.com; frame-ancestors 'self'
Content-Type: text/html
Date: Wed, 29 Nov 2023 10:52:41 GMT
Last-Modified: Wed, 29 Nov 2023 05:29:50 GMT
Server: routerapp
Vary: Accept-Encoding
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
---------END-HTTP---------

@shtripat that's just for the HEAD request, but it subsequently prints another output for the actual POST request also, e.g.

---------START-HTTP---------
POST /api/inspect/upload?filename=inspect-data.enc HTTP/1.1
Host: localhost:9000
User-Agent: Go-http-client/1.1
Transfer-Encoding: chunked
Content-Type: multipart/form-data; boundary=4753090a6ef6988e4affa6f6b45c9e5ab231162eef3246ae8e4a5a1504d0
X-Subnet-Api-Key: 4a782a02-d3d8-c0f8-5501-0e2afb127d11
Accept-Encoding: gzip

HTTP/1.1 200 OK
Transfer-Encoding: chunked
Content-Security-Policy-Report-Only: default-src 'self'; script-src 'self' https://js.chargebee.com https://js.stripe.com; frame-ancestors 'self'
Date: Wed, 29 Nov 2023 11:25:50 GMT
Server: authapp
Vary: Accept-Encoding
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN

0
---------END-HTTP---------

@vadmeste it seems to be working as expected.