Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

jshttp

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jshttp - npm Package Compare versions

Comparing version
0.5.0
to
0.5.1
+50
index.d.ts
import { AxiosInstance, AxiosPromise, AxiosRequestConfig, AxiosResponse, AxiosInterceptorManager } from 'axios'
// 相对于 `Axios` 附加的内容
export interface MockOptions {
status?: number
statusText?: string
headers?: any
data?: any
delay?: number
error?: string
}
export interface SignatureOptions {
key: string
secret: string
debug?: boolean
}
export interface JsHttpRequestConfig extends AxiosRequestConfig {
mock?: MockOptions
signature?: SignatureOptions
}
// 重写跟 `AxiosRequestConfig` 相关的类型
export interface JsHttpInstance {
(config: JsHttpRequestConfig): AxiosPromise
(url: string, config?: JsHttpRequestConfig): AxiosPromise
defaults: JsHttpRequestConfig
interceptors: {
request: AxiosInterceptorManager<JsHttpRequestConfig>
response: AxiosInterceptorManager<AxiosResponse>
}
getUri(config?: JsHttpRequestConfig): string
request<T = any, R = AxiosResponse<T>>(config: JsHttpRequestConfig): Promise<R>
get<T = any, R = AxiosResponse<T>>(url: string, config?: JsHttpRequestConfig): Promise<R>
delete<T = any, R = AxiosResponse<T>>(url: string, config?: JsHttpRequestConfig): Promise<R>
head<T = any, R = AxiosResponse<T>>(url: string, config?: JsHttpRequestConfig): Promise<R>
options<T = any, R = AxiosResponse<T>>(url: string, config?: JsHttpRequestConfig): Promise<R>
post<T = any, R = AxiosResponse<T>>(url: string, data?: any, config?: JsHttpRequestConfig): Promise<R>
put<T = any, R = AxiosResponse<T>>(url: string, data?: any, config?: JsHttpRequestConfig): Promise<R>
patch<T = any, R = AxiosResponse<T>>(url: string, data?: any, config?: JsHttpRequestConfig): Promise<R>
}
export interface JsHttpStatic extends JsHttpInstance {
create(config?: JsHttpRequestConfig): JsHttpInstance
}
declare const jshttp: JsHttpStatic
export default jshttp
+2
-1
{
"name": "jshttp",
"version": "0.5.0",
"version": "0.5.1",
"description": "基于 Axios 的 HTTP 请求库,内置了一些常用功能,支持在任何 Javascript 环境下运行",
"main": "index.js",
"typings": "./index.d.ts",
"scripts": {

@@ -7,0 +8,0 @@ "test": "mocha test/**/*.test.js"