Skip to content
Node: axios, fetch10 APIs

client

Package client provides an axios/fetch-style HTTP client over net/http. Node equivalent: axios, node-fetch.

import "github.com/sahilkhaire/gox/client"
## API reference

Select a symbol below — each page explains what it does, shows Node.js vs Go comparisons, and includes a runnable example.

Functions

SymbolNode.jsKindSummary
SetDefaultClientfuncSetDefaultClient replaces the client used by Fetch.

Types

SymbolNode.jsKindSummary
ClienttypeClient is a reusable HTTP client with defaults (axios instance).
RequestOptstypeRequestOpts configures a single request.
ResponsetypeResponse wraps an HTTP response.

Methods

SymbolNode.jsKindSummary
Response.Fetchfetch(url)methodFetch is a fetch()-style helper using the package default client.
RequestOpts.JSONBodymethodJSONBody returns RequestOpts with a JSON body.
Client.Newaxios.create()methodNew creates a Client with optional timeout.
RequestOpts.WithHeadersmethodWithHeaders returns RequestOpts with headers.
RequestOpts.WithMethodmethodWithMethod sets method on opts (helper for Fetch).
RequestOpts.WithQuerymethodWithQuery returns RequestOpts with query values.

MIT Licensed · Built for Node.js developers moving to Go