@e-mc/request
Advanced tools
Comparing version 0.9.12 to 0.9.13
{ | ||
"name": "@e-mc/request", | ||
"version": "0.9.12", | ||
"version": "0.9.13", | ||
"description": "Request constructor for E-mc.", | ||
@@ -20,7 +20,7 @@ "main": "index.js", | ||
"author": "An Pham <anpham6@gmail.com>", | ||
"license": "BSD 3-Clause", | ||
"license": "BSD-3-Clause", | ||
"homepage": "https://github.com/anpham6/e-mc#readme", | ||
"dependencies": { | ||
"@e-mc/module": "0.9.12", | ||
"@e-mc/types": "0.9.12", | ||
"@e-mc/module": "0.9.13", | ||
"@e-mc/types": "0.9.13", | ||
"combined-stream": "^1.0.8", | ||
@@ -27,0 +27,0 @@ "js-yaml": "^4.1.0", |
@@ -12,3 +12,3 @@ # @e-mc/request | ||
* [View Source](https://www.unpkg.com/@e-mc/types@0.9.12/lib/index.d.ts) | ||
* [View Source](https://www.unpkg.com/@e-mc/types@0.9.13/lib/index.d.ts) | ||
@@ -18,3 +18,3 @@ ```typescript | ||
import type { HttpAgentSettings, HttpProtocolVersion, HttpRequestClient, InternetProtocolVersion } from "./http"; | ||
import type { ApplyOptions, Aria2Options, FormDataPart, HeadersOnCallback, HostConfig, OpenOptions, PostOptions, ProxySettings, ReadExpectType, RequestInit, StatusOnCallback } from "./request"; | ||
import type { ApplyOptions, Aria2Options, FormDataPart, HeadersOnCallback, HostConfig, OpenOptions, PostOptions, ProxySettings, PutOptions, ReadExpectType, RequestInit, StatusOnCallback } from "./request"; | ||
import type { DnsLookupSettings, RequestModule, RequestSettings } from "./settings"; | ||
@@ -52,3 +52,4 @@ | ||
head(uri: string | URL, options?: OpenOptions): ClientRequest; | ||
post(uri: string | URL, data: unknown, contentType: string): Promise<Buffer | string | null>; | ||
put(uri: string | URL, data: unknown, options: PutOptions): Promise<Buffer | string | null>; | ||
put(uri: string | URL, data: unknown, contentType?: string, options?: PutOptions): Promise<Buffer | string | null>; | ||
post(uri: string | URL, parts: FormDataPart[]): Promise<Buffer | string | null>; | ||
@@ -207,5 +208,5 @@ post(uri: string | URL, form: Record<string, unknown>, parts: FormDataPart[]): Promise<Buffer | string | null>; | ||
- https://www.unpkg.com/@e-mc/types@0.9.12/lib/http.d.ts | ||
- https://www.unpkg.com/@e-mc/types@0.9.12/lib/request.d.ts | ||
- https://www.unpkg.com/@e-mc/types@0.9.12/lib/settings.d.ts | ||
- https://www.unpkg.com/@e-mc/types@0.9.13/lib/http.d.ts | ||
- https://www.unpkg.com/@e-mc/types@0.9.13/lib/request.d.ts | ||
- https://www.unpkg.com/@e-mc/types@0.9.13/lib/settings.d.ts | ||
@@ -212,0 +213,0 @@ * https://www.npmjs.com/package/@types/node |
@@ -8,2 +8,3 @@ import type { AuthValue } from '@e-mc/types/lib/http'; | ||
function parseHeader<T = unknown>(headers: IncomingHttpHeaders, name: string): T | undefined; | ||
function parseOutgoingHeaders(headers: OutgoingHttpHeaders | Headers | undefined): OutgoingHttpHeaders | undefined; | ||
function normalizeHeaders(headers: OutgoingHttpHeaders): OutgoingHttpHeaders; | ||
@@ -10,0 +11,0 @@ function getBasicAuth(auth: AuthValue): string; |
28
util.js
"use strict"; | ||
exports.cleanupStream = exports.byteLength = exports.hasSameStat = exports.getSize = exports.hasSize = exports.getTransferRate = exports.fromSeconds = exports.asFloat = exports.asInt = exports.trimPath = exports.isRetryable = exports.checkRetryable = exports.hasBasicAuth = exports.getBasicAuth = exports.normalizeHeaders = exports.parseHeader = void 0; | ||
exports.cleanupStream = exports.byteLength = exports.hasSameStat = exports.getSize = exports.hasSize = exports.getTransferRate = exports.fromSeconds = exports.asFloat = exports.asInt = exports.trimPath = exports.isRetryable = exports.checkRetryable = exports.hasBasicAuth = exports.getBasicAuth = exports.normalizeHeaders = exports.parseOutgoingHeaders = exports.parseHeader = void 0; | ||
const path = require("path"); | ||
@@ -28,2 +28,20 @@ const fs = require("fs"); | ||
exports.parseHeader = parseHeader; | ||
function parseOutgoingHeaders(headers) { | ||
if (headers) { | ||
if (globalThis.Headers && headers instanceof Headers) { | ||
const result = {}; | ||
headers.forEach((value, key) => { | ||
if (key === 'set-cookie') { | ||
(result[key] ||= []).push(value); | ||
} | ||
else { | ||
result[key] = value; | ||
} | ||
}); | ||
return result; | ||
} | ||
return headers; | ||
} | ||
} | ||
exports.parseOutgoingHeaders = parseOutgoingHeaders; | ||
function normalizeHeaders(headers) { | ||
@@ -41,7 +59,7 @@ const result = Object.create(null); | ||
default: | ||
if (Array.isArray(value)) { | ||
value = value.map(out => module_1.asString(out).trim()); | ||
break; | ||
if (!(0, types_1.isArray)(value)) { | ||
continue; | ||
} | ||
continue; | ||
value = value.map(out => module_1.asString(out).trim()); | ||
break; | ||
} | ||
@@ -48,0 +66,0 @@ if (value) { |
Sorry, the diff of this file is too big to display
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
134775
3014
213
+ Added@e-mc/module@0.9.13(transitive)
+ Added@e-mc/types@0.9.13(transitive)
- Removed@e-mc/module@0.9.12(transitive)
- Removed@e-mc/types@0.9.12(transitive)
Updated@e-mc/module@0.9.13
Updated@e-mc/types@0.9.13