ci: new publish method (#1451)

This commit is contained in:
Dax
2025-07-31 01:00:29 -04:00
committed by GitHub
parent b09ebf4645
commit 33cef075d2
190 changed files with 16142 additions and 13342 deletions

View File

@@ -0,0 +1,38 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package option
import (
"log"
"net/http"
"net/http/httputil"
)
// WithDebugLog logs the HTTP request and response content.
// If the logger parameter is nil, it uses the default logger.
//
// WithDebugLog is for debugging and development purposes only.
// It should not be used in production code. The behavior and interface
// of WithDebugLog is not guaranteed to be stable.
func WithDebugLog(logger *log.Logger) RequestOption {
return WithMiddleware(func(req *http.Request, nxt MiddlewareNext) (*http.Response, error) {
if logger == nil {
logger = log.Default()
}
if reqBytes, err := httputil.DumpRequest(req, true); err == nil {
logger.Printf("Request Content:\n%s\n", reqBytes)
}
resp, err := nxt(req)
if err != nil {
return resp, err
}
if respBytes, err := httputil.DumpResponse(resp, true); err == nil {
logger.Printf("Response Content:\n%s\n", respBytes)
}
return resp, err
})
}