1- // Package jttp provides a robust HTTP client with reasonable defaults and
1+ // Package gttp provides a robust HTTP client with reasonable defaults and
22// tunable behavior.
33//
44// The returned *http.Client is fully standard — callers use client.Do,
1717//
1818// Basic usage:
1919//
20- // client := jttp .New() // be sure to reuse this single object across multiple requests!
20+ // client := gttp .New() // be sure to reuse this single object across multiple requests!
2121// resp, err := client.Get("https://example.com")
2222//
2323// With options:
2424//
25- // client := jttp .New(
26- // jttp .WithTimeout(10 * time.Second),
27- // jttp .WithRetries(5),
28- // jttp .WithAdditionalRetryableStatusCodes(500),
25+ // client := gttp .New(
26+ // gttp .WithTimeout(10 * time.Second),
27+ // gttp .WithRetries(5),
28+ // gttp .WithAdditionalRetryableStatusCodes(500),
2929// )
30- package jttp
30+ package gttp
3131
3232import (
3333 "context"
@@ -288,13 +288,13 @@ func New(opts ...Option) *http.Client {
288288 var err error
289289 h2 , err = configureHTTP2 (tr , cfg .http2ReadIdleTimeout , cfg .http2PingTimeout )
290290 if err != nil {
291- panic (fmt .Sprintf ("jttp : unexpected error configuring HTTP/2: %v" , err ))
291+ panic (fmt .Sprintf ("gttp : unexpected error configuring HTTP/2: %v" , err ))
292292 }
293293 }
294294 base = tr
295295 }
296296
297- // Only a jttp -owned, direct transport can guarantee that the address
297+ // Only a gttp -owned, direct transport can guarantee that the address
298298 // validated by the IP policy is the address actually dialed. Custom
299299 // transports and proxies retain the existing request-time checks.
300300 ipPolicyAtDial := cfg .strictSSRFInitial && cfg .transport == nil && cfg .disableProxy && ! cfg .allowPrivateRedirects
@@ -458,7 +458,7 @@ func WithRetryableStatusCodes(codes ...int) Option {
458458// WithAdditionalRetryableStatusCodes adds status codes to the default retryable set
459459// without replacing it. For example, to also retry on 500:
460460//
461- // jttp .New(jttp .WithAdditionalRetryableStatusCodes(500))
461+ // gttp .New(gttp .WithAdditionalRetryableStatusCodes(500))
462462func WithAdditionalRetryableStatusCodes (codes ... int ) Option {
463463 return func (c * config ) {
464464 for _ , code := range codes {
@@ -481,7 +481,7 @@ func WithRetryableMethods(methods ...string) Option {
481481// WithAdditionalRetryableMethods adds HTTP methods to the default retryable set
482482// without replacing it. For example, to also retry POST and PUT:
483483//
484- // jttp .New(jttp .WithAdditionalRetryableMethods("POST", "PUT"))
484+ // gttp .New(gttp .WithAdditionalRetryableMethods("POST", "PUT"))
485485func WithAdditionalRetryableMethods (methods ... string ) Option {
486486 return func (c * config ) {
487487 for _ , m := range methods {
@@ -530,11 +530,11 @@ func WithRetryObserver(fn func(attempt int, req *http.Request, resp *http.Respon
530530// timeout, size cap, min-rate) are still applied on top, but note:
531531//
532532// The decompression-bomb guard (WithMaxCompressionRatio) is effectively
533- // disabled when a custom transport is supplied, because jttp can no longer
533+ // disabled when a custom transport is supplied, because gttp can no longer
534534// control the base transport's DisableCompression setting. The caller's
535535// transport is presumed to handle Accept-Encoding / gzip decoding itself,
536536// and once stdlib's default transport auto-decodes, the response arrives
537- // without a Content-Encoding header for jttp to act on. If you need the
537+ // without a Content-Encoding header for gttp to act on. If you need the
538538// bomb guard, use the default transport.
539539func WithTransport (rt http.RoundTripper ) Option {
540540 return func (c * config ) { c .transport = rt }
@@ -609,7 +609,7 @@ func WithDialKeepAlive(d time.Duration) Option {
609609//
610610// WithResolver is likewise ignored in the general case, but not in strict
611611// direct mode: when WithStrictSSRFProtection and WithNoProxy are set without
612- // WithAllowPrivateRedirects, jttp resolves the request hostname itself with the
612+ // WithAllowPrivateRedirects, gttp resolves the request hostname itself with the
613613// configured resolver, validates the full answer set, and calls this function
614614// only with an already-validated literal IP address. In that mode WithResolver
615615// controls the validation lookup, and a custom dialer that performs its own
@@ -625,7 +625,7 @@ func WithDialContext(fn func(ctx context.Context, network, address string) (net.
625625// This is useful for directing DNS queries to a specific server (e.g., 1.1.1.1)
626626// without replacing the entire dial function. Example:
627627//
628- // jttp .New(jttp .WithResolver(&net.Resolver{
628+ // gttp .New(gttp .WithResolver(&net.Resolver{
629629// PreferGo: true,
630630// Dial: func(ctx context.Context, network, address string) (net.Conn, error) {
631631// return (&net.Dialer{}).DialContext(ctx, "udp", "1.1.1.1:53")
@@ -716,9 +716,9 @@ func WithAllowPrivateRedirects() Option {
716716// attacker-controlled URLs.
717717//
718718// Combine this with [WithNoProxy] to bind validation to the actual network
719- // connection: jttp resolves each hostname once per new connection, validates
719+ // connection: gttp resolves each hostname once per new connection, validates
720720// every returned address, and dials an approved literal address. With a proxy
721- // or custom transport, jttp cannot control the target dial and therefore
721+ // or custom transport, gttp cannot control the target dial and therefore
722722// retains request-time DNS preflight checks instead. The preflight path is
723723// also retained with [WithAllowPrivateRedirects], whose redirect-specific
724724// exception cannot be represented safely by a connection-wide dial policy.
0 commit comments