Comparing version 1.1.4-beta2 to 1.1.4
{ | ||
"name": "zan-ajax", | ||
"version": "1.1.4-beta2", | ||
"version": "1.1.4", | ||
"description": "Promise based HTTP client for the browser and node", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -59,3 +59,3 @@ ## ajax | ||
* **`method` / `type`**: <`string`> 请求的类型,默认`GET`请求 | ||
* **`data`**: <`object`> HTTP请求的参数,`GET` / `HEAD`类请求会作为URL参数,`POST` / `PUT`等请求会作为`body` | ||
* **`data`**: <`any`> HTTP请求的参数,`GET` / `HEAD`类请求会作为URL参数,`POST` / `PUT`等请求会作为`body` | ||
* **`contentType`**: <`string`> 发送给服务器的数据类型,`POST` / `PUT`等请求默认值为* `'application/x-www-form-urlencoded; charset=UTF-8'` | ||
@@ -62,0 +62,0 @@ * **`dataType`**: <`string`> 请求的返回值类型,默认`json`,可选项`arraybuffer`, `blob`, `document`, `json`, * `text`, `stream` |
import { CancelToken } from 'axios'; | ||
export type RequestParams = { [key: string]: any } | any[]; | ||
export interface IJsonpOptions { | ||
dataType: 'jsonp' | 'JSONP'; | ||
url: string; | ||
data?: RequestParams; | ||
data?: any; | ||
jsonp?: string; | ||
@@ -18,6 +16,5 @@ jsonpCallback?: string | (() => string); | ||
url: string; | ||
data?: RequestParams; | ||
data?: any; | ||
method?: string; | ||
contentType?: string; | ||
dataType: | ||
dataType?: | ||
| 'json' | ||
@@ -35,2 +32,3 @@ | 'arraybuffer' | ||
| 'ARRAYBUFFER'; | ||
contentType?: string; | ||
headers?: { [key: string]: string }; | ||
@@ -48,3 +46,3 @@ withCredentials?: boolean; | ||
export type RequestOptions = IJsonpOptions | IAjaxOptions; | ||
export type RequestOptions = IAjaxOptions | IJsonpOptions; | ||
@@ -55,7 +53,7 @@ export interface IRequestConfig { | ||
declare function ajax( | ||
declare function ajax<T = any>( | ||
options: RequestOptions, | ||
config?: IRequestConfig | ||
): Promise; | ||
): Promise<T>; | ||
export default ajax; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
27945
543