HTTP Methods
Basic HTTP Requests
GET, POST, PUT, DELETE, and PATCH requests made simple.
Z-Fetch supports all the common HTTP methods with a simple, intuitive API.
Making a request can be as easy as:
Supported Methods
- GET - Retrieve data
- POST - Create new resources
- PUT - Update/replace resources
- DELETE - Remove resources
- PATCH - Partial updates
Heads Up!
All method names are uppercase to match the HTTP verbs they represent. When
using an instance, they become lowercase: api.get('url').
How It Works
- Each request can be made separately or using an instance
- Takes a URL and optional options object
- Options support all native fetch options plus Z-Fetch enhancements
- Returns a result object with
data,error, and nativeresponse - Includes additional methods for refetching, canceling, and more
Dev Note
Z-Fetch is 100% type safe, so expect cool auto-completions from your IDE.