New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@http4t/core

Package Overview
Dependencies
Maintainers
4
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@http4t/core - npm Package Compare versions

Comparing version 0.0.148 to 0.0.149

6

json.d.ts
import { Data, HttpBody, HttpMessage, HttpRequest, HttpResponse } from "./contract";
export declare class JsonBody<T = any> implements AsyncIterable<Data> {
readonly data: Readonly<T>;
readonly ifYouAreSeeingThisInATestAssertion = "You probably forgot to call toJSON(message) on your HttpMessage, which would have called Symbol.asyncIterator on this body";
readonly ifYouAreSeeingThisInATestAssertion = "You probably forgot to call toJSON(message) on your HttpMessage, which would have called Symbol.asyncIterator on this body.";
constructor(data: Readonly<T>);

@@ -11,3 +11,5 @@ [Symbol.asyncIterator](): AsyncIterator<Data>;

* A JsonBody is an AsyncIterable<Data> (and is therefore a Body), which will lazily yield
* JSON.stringify(data) when asked to stream, but also contains the original data without
* JSON.stringify(data) when asked to stream.
*
* But also contains the original data without
* needing to be deserialised.

@@ -14,0 +16,0 @@ *

@@ -71,3 +71,3 @@ "use strict";

this.data = data;
this.ifYouAreSeeingThisInATestAssertion = "You probably forgot to call toJSON(message) on your HttpMessage, which would have called Symbol.asyncIterator on this body";
this.ifYouAreSeeingThisInATestAssertion = "You probably forgot to call toJSON(message) on your HttpMessage, which would have called Symbol.asyncIterator on this body.";
}

@@ -85,3 +85,5 @@ JsonBody.prototype[Symbol.asyncIterator] = function () {

* A JsonBody is an AsyncIterable<Data> (and is therefore a Body), which will lazily yield
* JSON.stringify(data) when asked to stream, but also contains the original data without
* JSON.stringify(data) when asked to stream.
*
* But also contains the original data without
* needing to be deserialised.

@@ -88,0 +90,0 @@ *

@@ -12,3 +12,3 @@ import {bufferText} from "./bodies";

public readonly ifYouAreSeeingThisInATestAssertion =
"You probably forgot to call toJSON(message) on your HttpMessage, which would have called Symbol.asyncIterator on this body";
"You probably forgot to call toJSON(message) on your HttpMessage, which would have called Symbol.asyncIterator on this body.";

@@ -29,3 +29,5 @@ constructor(public readonly data: Readonly<T>) {

* A JsonBody is an AsyncIterable<Data> (and is therefore a Body), which will lazily yield
* JSON.stringify(data) when asked to stream, but also contains the original data without
* JSON.stringify(data) when asked to stream.
*
* But also contains the original data without
* needing to be deserialised.

@@ -32,0 +34,0 @@ *

{
"name": "@http4t/core",
"version": "0.0.148",
"version": "0.0.149",
"license": "Apache-2.0"
}

@@ -23,3 +23,3 @@ import {DecodedPair, decodePairs, encodePairs} from "./urlEncoding";

const newQuery = encodePairs(expand([name, value]));
if (typeof query === 'undefined' || query.length === 0) return newQuery;
if (typeof query === 'undefined' || query.length === 0) return newQuery as string;
return `${query}&${newQuery}`

@@ -26,0 +26,0 @@ }

@@ -18,4 +18,5 @@ import { Header, HttpBody, HttpRequest, Method, ParsedAuthority } from "./contract";

export declare function setQuery(message: HttpRequest, name: string, value: string | undefined): HttpRequest;
export declare function removeQuery(message: HttpRequest, name: string): HttpRequest;
export declare function authority(request: HttpRequest): ParsedAuthority;
export declare function uri(request: HttpRequest): Uri;
export declare function uriString(request: HttpRequest): string;

@@ -23,3 +23,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.uriString = exports.uri = exports.authority = exports.setQuery = exports.setQueries = exports.appendQuery = exports.appendQueries = exports.delete_ = exports.patch = exports.put = exports.post = exports.get = exports.request = void 0;
exports.uriString = exports.uri = exports.authority = exports.removeQuery = exports.setQuery = exports.setQueries = exports.appendQuery = exports.appendQueries = exports.delete_ = exports.patch = exports.put = exports.post = exports.get = exports.request = void 0;
var headers_1 = require("./headers");

@@ -102,2 +102,7 @@ var queries_1 = require("./queries");

exports.setQuery = setQuery;
function removeQuery(message, name) {
var query = message.uri.query;
return objects_1.modify(message, { uri: objects_1.modify(message.uri, { query: queries_1.removeQuery(query, name) }) });
}
exports.removeQuery = removeQuery;
function authority(request) {

@@ -104,0 +109,0 @@ if (typeof request.uri.authority != 'undefined')

@@ -7,3 +7,4 @@ import {Header, HttpBody, HttpRequest, Method, ParsedAuthority} from "./contract";

setQueries as uriSetQueries,
setQuery as uriSetQuery
setQuery as uriSetQuery,
removeQuery as uriRemoveQuery
} from "./queries";

@@ -66,2 +67,7 @@ import {

export function removeQuery(message: HttpRequest, name: string): HttpRequest {
const query = message.uri.query;
return modify(message, {uri: modify(message.uri, {query: uriRemoveQuery(query, name)})})
}
export function authority(request: HttpRequest): ParsedAuthority {

@@ -68,0 +74,0 @@ if (typeof request.uri.authority != 'undefined')

@@ -7,2 +7,2 @@ export declare type DecodedPair = [string, string | undefined];

export declare function encodePair([name, value]: DecodedPair): string;
export declare function encodePairs(values: DecodedPair[]): string;
export declare function encodePairs(values: DecodedPair[]): string | undefined;

@@ -51,2 +51,4 @@ "use strict";

function encodePairs(values) {
if (values.length == 0)
return undefined;
return values

@@ -53,0 +55,0 @@ .map(encodePair)

@@ -18,3 +18,3 @@ export type DecodedPair = [string, string | undefined];

export function decodePairs(value: string | undefined): DecodedPair[] {
if(typeof value === "undefined") return [];
if (typeof value === "undefined") return [];
return value

@@ -33,3 +33,4 @@ .split('&')

export function encodePairs(values: DecodedPair[]): string {
export function encodePairs(values: DecodedPair[]): string | undefined {
if (values.length == 0) return undefined;
return values

@@ -36,0 +37,0 @@ .map(encodePair)

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc