Comparing version 0.4.0 to 0.5.0
/** HTTP request method to indicate the desired action to be performed for a given resource. */ | ||
export declare enum HttpMethod { | ||
/** The CONNECT method establishes a tunnel to the server identified by the target resource. */ | ||
CONNECT = "CONNECT", | ||
CONNECT = "connect", | ||
/** The DELETE method deletes the specified resource. */ | ||
DELETE = "DELETE", | ||
DELETE = "delete", | ||
/** The GET method requests a representation of the specified resource. Requests using GET should only retrieve data. */ | ||
GET = "GET", | ||
GET = "get", | ||
/** The HEAD method asks for a response identical to that of a GET request, but without the response body. */ | ||
HEAD = "HEAD", | ||
HEAD = "head", | ||
/** The OPTIONS method is used to describe the communication options for the target resource. */ | ||
OPTIONS = "OPTIONS", | ||
OPTIONS = "options", | ||
/** The PATCH method is used to apply partial modifications to a resource. */ | ||
PATCH = "PATCH", | ||
PATCH = "patch", | ||
/** The POST method is used to submit an entity to the specified resource, often causing a change in state or side effects on the server. */ | ||
POST = "POST", | ||
POST = "post", | ||
/** The PUT method replaces all current representations of the target resource with the request payload. */ | ||
PUT = "PUT", | ||
PUT = "put", | ||
/** The TRACE method performs a message loop-back test along the path to the target resource. */ | ||
TRACE = "TRACE" | ||
TRACE = "trace" | ||
} | ||
@@ -25,5 +25,5 @@ /** HTTP request protocol. */ | ||
/** Unencrypted HTTP protocol. */ | ||
HTTP = "HTTP", | ||
HTTP = "http", | ||
/** Encrypted HTTPS protocol. */ | ||
HTTPS = "HTTPS" | ||
HTTPS = "https" | ||
} | ||
@@ -30,0 +30,0 @@ /** HTTP request or response headers. */ |
@@ -7,19 +7,19 @@ "use strict"; | ||
/** The CONNECT method establishes a tunnel to the server identified by the target resource. */ | ||
HttpMethod["CONNECT"] = "CONNECT"; | ||
HttpMethod["CONNECT"] = "connect"; | ||
/** The DELETE method deletes the specified resource. */ | ||
HttpMethod["DELETE"] = "DELETE"; | ||
HttpMethod["DELETE"] = "delete"; | ||
/** The GET method requests a representation of the specified resource. Requests using GET should only retrieve data. */ | ||
HttpMethod["GET"] = "GET"; | ||
HttpMethod["GET"] = "get"; | ||
/** The HEAD method asks for a response identical to that of a GET request, but without the response body. */ | ||
HttpMethod["HEAD"] = "HEAD"; | ||
HttpMethod["HEAD"] = "head"; | ||
/** The OPTIONS method is used to describe the communication options for the target resource. */ | ||
HttpMethod["OPTIONS"] = "OPTIONS"; | ||
HttpMethod["OPTIONS"] = "options"; | ||
/** The PATCH method is used to apply partial modifications to a resource. */ | ||
HttpMethod["PATCH"] = "PATCH"; | ||
HttpMethod["PATCH"] = "patch"; | ||
/** The POST method is used to submit an entity to the specified resource, often causing a change in state or side effects on the server. */ | ||
HttpMethod["POST"] = "POST"; | ||
HttpMethod["POST"] = "post"; | ||
/** The PUT method replaces all current representations of the target resource with the request payload. */ | ||
HttpMethod["PUT"] = "PUT"; | ||
HttpMethod["PUT"] = "put"; | ||
/** The TRACE method performs a message loop-back test along the path to the target resource. */ | ||
HttpMethod["TRACE"] = "TRACE"; | ||
HttpMethod["TRACE"] = "trace"; | ||
})(HttpMethod = exports.HttpMethod || (exports.HttpMethod = {})); | ||
@@ -30,5 +30,5 @@ /** HTTP request protocol. */ | ||
/** Unencrypted HTTP protocol. */ | ||
HttpProtocol["HTTP"] = "HTTP"; | ||
HttpProtocol["HTTP"] = "http"; | ||
/** Encrypted HTTPS protocol. */ | ||
HttpProtocol["HTTPS"] = "HTTPS"; | ||
HttpProtocol["HTTPS"] = "https"; | ||
})(HttpProtocol = exports.HttpProtocol || (exports.HttpProtocol = {})); | ||
@@ -35,0 +35,0 @@ /** HTTP request or response headers. */ |
{ | ||
"name": "http-types", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "Library for JSON serialisation of HTTP exchanges", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
/** HTTP request method to indicate the desired action to be performed for a given resource. */ | ||
export enum HttpMethod { | ||
/** The CONNECT method establishes a tunnel to the server identified by the target resource. */ | ||
CONNECT = "CONNECT", | ||
CONNECT = "connect", | ||
/** The DELETE method deletes the specified resource. */ | ||
DELETE = "DELETE", | ||
DELETE = "delete", | ||
/** The GET method requests a representation of the specified resource. Requests using GET should only retrieve data. */ | ||
GET = "GET", | ||
GET = "get", | ||
/** The HEAD method asks for a response identical to that of a GET request, but without the response body. */ | ||
HEAD = "HEAD", | ||
HEAD = "head", | ||
/** The OPTIONS method is used to describe the communication options for the target resource. */ | ||
OPTIONS = "OPTIONS", | ||
OPTIONS = "options", | ||
/** The PATCH method is used to apply partial modifications to a resource. */ | ||
PATCH = "PATCH", | ||
PATCH = "patch", | ||
/** The POST method is used to submit an entity to the specified resource, often causing a change in state or side effects on the server. */ | ||
POST = "POST", | ||
POST = "post", | ||
/** The PUT method replaces all current representations of the target resource with the request payload. */ | ||
PUT = "PUT", | ||
PUT = "put", | ||
/** The TRACE method performs a message loop-back test along the path to the target resource. */ | ||
TRACE = "TRACE" | ||
TRACE = "trace" | ||
} | ||
@@ -26,5 +26,5 @@ | ||
/** Unencrypted HTTP protocol. */ | ||
HTTP = "HTTP", | ||
HTTP = "http", | ||
/** Encrypted HTTPS protocol. */ | ||
HTTPS = "HTTPS" | ||
HTTPS = "https" | ||
} | ||
@@ -31,0 +31,0 @@ |
@@ -214,3 +214,2 @@ import { | ||
expect(exchange.request.query.get("a")).toBe("b"); | ||
console.log("AAAA " + JSON.stringify(exchange)); | ||
expect(JSON.parse(JSON.stringify(exchange))["request"]["query"]["a"]).toBe( | ||
@@ -220,1 +219,20 @@ "b" | ||
}); | ||
test("Correct case of HTTP method and protocol", () => { | ||
const request = HttpRequestBuilder.fromPathnameAndQuery({ | ||
method: HttpMethod.GET, | ||
protocol: HttpProtocol.HTTPS, | ||
host: "example.com", | ||
pathname: "/my/path", | ||
query: { | ||
a: "b", | ||
q: ["1", "2"] | ||
}, | ||
headers: {}, | ||
body: "request string body" | ||
}); | ||
const parsedJson = JSON.parse(JSON.stringify(request)); | ||
expect(parsedJson["method"]).toBe("get"); | ||
expect(parsedJson["protocol"]).toBe("https"); | ||
}); |
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
47654
1070