🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

fetch-with-json

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fetch-with-json - npm Package Compare versions

Comparing version
1.0.0
to
2.0.0-alpha.1
+10
-3
es/index.d.ts

@@ -1,2 +0,3 @@

export interface FetchOptions extends RequestInit {
export type RequestMethod = 'get' | 'delete' | 'head' | 'options' | 'post' | 'put' | 'patch' | 'purge' | 'link' | 'unlink';
export interface FetchOptions<M extends string = RequestMethod> extends RequestInit {
/**

@@ -7,2 +8,8 @@ * The request url.

/**
* The request method. You can override the default request method type by
* specifying your request method type.
* For example `FetchOptions<MyRequestType>`.
*/
method?: M;
/**
* The data to send to the server. The data will be stringified using

@@ -80,6 +87,6 @@ * `JSON.stringify` before being sent to the server and the `Content-Type`

export interface FetchMethod {
<T = any>(options: FetchOptions): Promise<FetchResponse<T>>;
<T = any>(options: FetchOptions, rawResponse: true): Promise<Response>;
<T = any, M extends string = RequestMethod>(options: FetchOptions<M>): Promise<FetchResponse<T>>;
<T = any, M extends string = RequestMethod>(options: FetchOptions<M>, rawResponse: true): Promise<Response>;
}
declare const fetchWithJSON: FetchMethod;
export default fetchWithJSON;

@@ -1,2 +0,3 @@

export interface FetchOptions extends RequestInit {
export type RequestMethod = 'get' | 'delete' | 'head' | 'options' | 'post' | 'put' | 'patch' | 'purge' | 'link' | 'unlink';
export interface FetchOptions<M extends string = RequestMethod> extends RequestInit {
/**

@@ -7,2 +8,8 @@ * The request url.

/**
* The request method. You can override the default request method type by
* specifying your request method type.
* For example `FetchOptions<MyRequestType>`.
*/
method?: M;
/**
* The data to send to the server. The data will be stringified using

@@ -80,6 +87,6 @@ * `JSON.stringify` before being sent to the server and the `Content-Type`

export interface FetchMethod {
<T = any>(options: FetchOptions): Promise<FetchResponse<T>>;
<T = any>(options: FetchOptions, rawResponse: true): Promise<Response>;
<T = any, M extends string = RequestMethod>(options: FetchOptions<M>): Promise<FetchResponse<T>>;
<T = any, M extends string = RequestMethod>(options: FetchOptions<M>, rawResponse: true): Promise<Response>;
}
declare const fetchWithJSON: FetchMethod;
export default fetchWithJSON;
{
"name": "fetch-with-json",
"description": "Some tweaks to the Fetch API to make it easier to communicate with the server using JSON.",
"version": "1.0.0",
"version": "2.0.0-alpha.1",
"main": "lib/index.js",

@@ -6,0 +6,0 @@ "types": "es/index.d.ts",