@http4t/core
Advanced tools
Comparing version 0.0.151 to 0.0.152
{ | ||
"name": "@http4t/core", | ||
"version": "0.0.151", | ||
"version": "0.0.152", | ||
"license": "Apache-2.0" | ||
} |
import { Header, HttpBody, HttpRequest, Method, ParsedAuthority } from "./contract"; | ||
import { QueryValue } from "./queries"; | ||
import { Uri, UriLike } from "./uri"; | ||
export declare function request(method: Method, uri: UriLike, body?: HttpBody, ...headers: Header[]): HttpRequest; | ||
export declare function requestOf(method: Method, uri: UriLike, body?: HttpBody, ...headers: Header[]): HttpRequest; | ||
export declare function get(uri: UriLike, ...headers: Header[]): HttpRequest; | ||
@@ -6,0 +6,0 @@ export declare function post(uri: UriLike, body?: HttpBody, ...headers: Header[]): HttpRequest; |
@@ -23,3 +23,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.uriString = exports.uri = exports.authority = exports.removeQueries = exports.removeQuery = exports.setQuery = exports.setQueries = exports.appendQuery = exports.appendQueries = exports.queries = exports.query = exports.delete_ = exports.patch = exports.put = exports.post = exports.get = exports.request = void 0; | ||
exports.uriString = exports.uri = exports.authority = exports.removeQueries = exports.removeQuery = exports.setQuery = exports.setQueries = exports.appendQuery = exports.appendQueries = exports.queries = exports.query = exports.delete_ = exports.patch = exports.put = exports.post = exports.get = exports.requestOf = void 0; | ||
var headers_1 = require("./headers"); | ||
@@ -29,3 +29,3 @@ var queries_1 = require("./queries"); | ||
var objects_1 = require("./util/objects"); | ||
function request(method, uri, body) { | ||
function requestOf(method, uri, body) { | ||
var headers = []; | ||
@@ -42,3 +42,3 @@ for (var _i = 3; _i < arguments.length; _i++) { | ||
} | ||
exports.request = request; | ||
exports.requestOf = requestOf; | ||
function get(uri) { | ||
@@ -49,3 +49,3 @@ var headers = []; | ||
} | ||
return request.apply(void 0, __spread(["GET", uri, undefined], headers)); | ||
return requestOf.apply(void 0, __spread(["GET", uri, undefined], headers)); | ||
} | ||
@@ -58,3 +58,3 @@ exports.get = get; | ||
} | ||
return request.apply(void 0, __spread(["POST", uri, body], headers)); | ||
return requestOf.apply(void 0, __spread(["POST", uri, body], headers)); | ||
} | ||
@@ -67,3 +67,3 @@ exports.post = post; | ||
} | ||
return request.apply(void 0, __spread(["PUT", uri, body], headers)); | ||
return requestOf.apply(void 0, __spread(["PUT", uri, body], headers)); | ||
} | ||
@@ -76,3 +76,3 @@ exports.put = put; | ||
} | ||
return request.apply(void 0, __spread(["PATCH", uri, body], headers)); | ||
return requestOf.apply(void 0, __spread(["PATCH", uri, body], headers)); | ||
} | ||
@@ -85,3 +85,3 @@ exports.patch = patch; | ||
} | ||
return request.apply(void 0, __spread(["DELETE", uri, undefined], headers)); | ||
return requestOf.apply(void 0, __spread(["DELETE", uri, undefined], headers)); | ||
} | ||
@@ -88,0 +88,0 @@ exports.delete_ = delete_; |
@@ -20,3 +20,3 @@ import {Header, HttpBody, HttpRequest, Method, ParsedAuthority} from "./contract"; | ||
export function request(method: Method, uri: UriLike, body?: HttpBody, ...headers: Header[]): HttpRequest { | ||
export function requestOf(method: Method, uri: UriLike, body?: HttpBody, ...headers: Header[]): HttpRequest { | ||
return { | ||
@@ -31,19 +31,19 @@ method, | ||
export function get(uri: UriLike, ...headers: Header[]): HttpRequest { | ||
return request("GET", uri, undefined, ...headers); | ||
return requestOf("GET", uri, undefined, ...headers); | ||
} | ||
export function post(uri: UriLike, body?: HttpBody, ...headers: Header[]): HttpRequest { | ||
return request("POST", uri, body, ...headers); | ||
return requestOf("POST", uri, body, ...headers); | ||
} | ||
export function put(uri: UriLike, body?: HttpBody, ...headers: Header[]): HttpRequest { | ||
return request("PUT", uri, body, ...headers); | ||
return requestOf("PUT", uri, body, ...headers); | ||
} | ||
export function patch(uri: UriLike, body?: HttpBody, ...headers: Header[]): HttpRequest { | ||
return request("PATCH", uri, body, ...headers); | ||
return requestOf("PATCH", uri, body, ...headers); | ||
} | ||
export function delete_(uri: UriLike | string, ...headers: Header[]): HttpRequest { | ||
return request("DELETE", uri, undefined, ...headers); | ||
return requestOf("DELETE", uri, undefined, ...headers); | ||
} | ||
@@ -50,0 +50,0 @@ |
import { Header, HttpBody, HttpResponse } from "./contract"; | ||
export declare function response(status: number, body?: HttpBody, ...headers: Header[]): HttpResponse; | ||
export declare function responseOf(status: number, body?: HttpBody, ...headers: Header[]): HttpResponse; | ||
export declare function ok(body?: HttpBody, ...headers: Header[]): HttpResponse; | ||
export declare function notFound(body?: HttpBody, ...headers: Header[]): HttpResponse; |
@@ -23,4 +23,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.notFound = exports.ok = exports.response = void 0; | ||
function response(status, body) { | ||
exports.notFound = exports.ok = exports.responseOf = void 0; | ||
function responseOf(status, body) { | ||
var headers = []; | ||
@@ -32,3 +32,3 @@ for (var _i = 2; _i < arguments.length; _i++) { | ||
} | ||
exports.response = response; | ||
exports.responseOf = responseOf; | ||
function ok(body) { | ||
@@ -39,3 +39,3 @@ var headers = []; | ||
} | ||
return response.apply(void 0, __spread([200, body], headers)); | ||
return responseOf.apply(void 0, __spread([200, body], headers)); | ||
} | ||
@@ -48,5 +48,5 @@ exports.ok = ok; | ||
} | ||
return response.apply(void 0, __spread([404, body], headers)); | ||
return responseOf.apply(void 0, __spread([404, body], headers)); | ||
} | ||
exports.notFound = notFound; | ||
//# sourceMappingURL=responses.js.map |
import {Header, HttpBody, HttpResponse} from "./contract"; | ||
export function response(status: number, body?: HttpBody, ...headers: Header[]): HttpResponse { | ||
export function responseOf(status: number, body?: HttpBody, ...headers: Header[]): HttpResponse { | ||
return {status, headers: headers, body: body ? body : ''} | ||
@@ -8,7 +8,7 @@ } | ||
export function ok(body?: HttpBody, ...headers: Header[]): HttpResponse { | ||
return response(200, body, ...headers); | ||
return responseOf(200, body, ...headers); | ||
} | ||
export function notFound(body?: HttpBody, ...headers: Header[]): HttpResponse { | ||
return response(404, body, ...headers); | ||
return responseOf(404, body, ...headers); | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
171847