@tomphttp/bare-client
Advanced tools
Comparing version 2.1.0 to 2.2.0-alpha
@@ -25,11 +25,2 @@ export declare type BareMethod = 'GET' | 'POST' | 'DELETE' | 'OPTIONS' | 'PUT' | 'PATCH' | 'UPDATE' | string; | ||
} | ||
export declare type BareBodyInit = Blob | BufferSource | FormData | URLSearchParams | ReadableStream | undefined | null; | ||
export declare type BareFetchInit = { | ||
method?: BareMethod; | ||
headers?: Headers | BareHeaders; | ||
body?: BareBodyInit; | ||
cache?: BareCache; | ||
redirect?: 'follow' | 'manual' | 'error' | string; | ||
signal?: AbortSignal; | ||
}; | ||
export interface BareMaintainer { | ||
@@ -36,0 +27,0 @@ email?: string; |
@@ -1,2 +0,2 @@ | ||
import type { BareBodyInit, BareCache, BareHeaders, BareMethod, BareResponse, BareWebSocketMeta } from './BareTypes.js'; | ||
import type { BareCache, BareHeaders, BareMethod, BareResponse, BareWebSocketMeta } from './BareTypes.js'; | ||
export declare const statusEmpty: number[]; | ||
@@ -23,3 +23,3 @@ export declare const statusRedirect: number[]; | ||
abstract connect(remote: URL, protocols: string[], getRequestHeaders: GetRequestHeadersCallback, onMeta: MetaCallback, onReadyState: ReadyStateCallback, webSocketImpl: WebSocketImpl): WebSocket; | ||
abstract request(method: BareMethod, requestHeaders: BareHeaders, body: BareBodyInit, remote: URL, cache: BareCache | undefined, duplex: string | undefined, signal: AbortSignal | undefined): Promise<BareResponse>; | ||
abstract request(method: BareMethod, requestHeaders: BareHeaders, body: BodyInit | null, remote: URL, cache: BareCache | undefined, duplex: string | undefined, signal: AbortSignal | undefined): Promise<BareResponse>; | ||
protected base: URL; | ||
@@ -26,0 +26,0 @@ /** |
@@ -549,4 +549,3 @@ // The user likely has overwritten all networking functions after importing bare-client | ||
options.headers = this.createBareHeaders(remote, bareHeaders); | ||
const request = new Request(this.http + '?cache=' + md5(remote.toString()), options); | ||
const response = await fetch(request); | ||
const response = await fetch(this.http + '?cache=' + md5(remote.toString()), options); | ||
const readResponse = await this.readBareResponse(response); | ||
@@ -781,2 +780,5 @@ const result = new Response(statusEmpty.includes(readResponse.status) ? undefined : response.body, { | ||
: inputHeaders; | ||
// @ts-ignore | ||
const duplex = init?.duplex; | ||
const body = init?.body || req.body; | ||
let urlO = new URL(req.url); | ||
@@ -789,5 +791,3 @@ const client = await this.demand(); | ||
headers.Host = urlO.host; | ||
const response = await client.request(req.method, headers, req.body, urlO, req.cache, | ||
// @ts-ignore | ||
req.duplex, req.signal); | ||
const response = await client.request(req.method, headers, body, urlO, req.cache, duplex, req.signal); | ||
response.finalURL = urlO.toString(); | ||
@@ -794,0 +794,0 @@ const redirect = init?.redirect || req.redirect; |
@@ -1,2 +0,2 @@ | ||
import type { BareBodyInit, BareCache, BareHeaders, BareMethod, BareResponse } from './BareTypes.js'; | ||
import type { BareCache, BareHeaders, BareMethod, BareResponse } from './BareTypes.js'; | ||
import { Client } from './Client.js'; | ||
@@ -9,5 +9,5 @@ import type { ReadyStateCallback, MetaCallback, GetRequestHeadersCallback } from './Client.js'; | ||
connect(remote: URL, protocols: string[], getRequestHeaders: GetRequestHeadersCallback, onMeta: MetaCallback, onReadyState: ReadyStateCallback): WebSocket; | ||
request(method: BareMethod, requestHeaders: BareHeaders, body: BareBodyInit, remote: URL, cache: BareCache | undefined, duplex: string | undefined, signal: AbortSignal | undefined): Promise<BareResponse>; | ||
request(method: BareMethod, requestHeaders: BareHeaders, body: BodyInit | null, remote: URL, cache: BareCache | undefined, duplex: string | undefined, signal: AbortSignal | undefined): Promise<BareResponse>; | ||
private readBareResponse; | ||
createBareHeaders(remote: URL, bareHeaders: BareHeaders, forwardHeaders?: string[], passHeaders?: string[], passStatus?: number[]): Headers; | ||
} |
{ | ||
"name": "@tomphttp/bare-client", | ||
"version": "2.1.0", | ||
"version": "2.2.0-alpha", | ||
"homepage": "https://github.com/tomphttp", | ||
@@ -5,0 +5,0 @@ "bugs": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
213712
1890
1