
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
@cordisjs/plugin-http
Advanced tools
Fetch-based axios-style HTTP client.
"und" comes from undici, an HTTP/1.1 client officially supported by Node.js team.
"ios" comes from axios, a popular HTTP client for browser and Node.js.
import Undios from '@cordisjs/plugin-http'
const http = new Undios()
const data = await http.get('https://example.com')
const data = await http.post('https://example.com', body)
const { status, data } = await http('https://example.com', { method: 'GET' })
interface HTTP {
<K extends keyof ResponseTypes>(url: string, config: Config & { responseType: K }): Promise<Response<ResponseTypes[K]>>
<T = any>(url: string | URL, config?: Config): Promise<Response<T>>
}
Send a request.
interface HTTP {
get: Request1
delete: Request1
head(url: string, config?: Config): Promise<Headers>
}
interface Request1 {
<K extends keyof ResponseTypes>(url: string, config: Config & { responseType: K }): Promise<ResponseTypes[K]>
<T = any>(url: string, config?: Config): Promise<T>
}
Send a GET / DELETE / HEAD request.
interface HTTP {
patch: Request2
post: Request2
put: Request2
}
interface Request2 {
<K extends keyof ResponseTypes>(url: string, data: any, config: Config & { responseType: K }): Promise<ResponseTypes[K]>
<T = any>(url: string, data?: any, config?: Config): Promise<T>
}
interface HTTP {
ws(url: string | URL, config?: Config): WebSocket
}
Open a WebSocket connection.
[!NOTE]
Currently we will use
ws
package to polyfillWebSocket
in Node.js.Once Node.js has a stable WebSocket API, we will switch to it.
interface Config {
baseURL?: string
method?: Method
headers?: Record<string, string>
redirect?: RequestRedirect
keepAlive?: boolean
params?: Record<string, any>
data?: any
responseType?: keyof ResponseTypes
timeout?: number
}
The base URL of the request. If it is set, the url
will be resolved against it.
See URL#base.
See fetch#method.
See fetch#headers.
See fetch#redirect.
See fetch#keepalive.
Additional query parameters. They will be appended to the URL.
The request body. Currently support below types:
Supported response types:
interface ResponseTypes {
json: any
text: string
stream: ReadableStream<Uint8Array>
blob: Blob
formdata: FormData
arraybuffer: ArrayBuffer
}
The request timeout in milliseconds.
[!NOTE]
In order to use a proxy agent, you need to install
@cordisjs/plugin-proxy-agent
.
interface Response<T> {
status: number
statusText: string
headers: Headers
data: T
}
See Response#status.
See Response#statusText.
See Response#headers.
The decoded response body.
class Undios {
constructor(config?: Config)
}
function is(error: any): error is Undios.Error
FAQs
Fetch-based axios-style HTTP client
The npm package @cordisjs/plugin-http receives a total of 794 weekly downloads. As such, @cordisjs/plugin-http popularity was classified as not popular.
We found that @cordisjs/plugin-http demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.