tcp-http-client
Advanced tools
Comparing version 1.0.5 to 1.0.6
{ | ||
"name": "tcp-http-client", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "Basic Http client using built in net and tls modules", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -14,3 +14,4 @@ # TCP-Http-Client | ||
```javascript | ||
const {TCPHttpClient, TCPHttpRequest} = require('tcp-http-client'); | ||
const {TCPHttpClient, TCPHttpRequest, TCPHttpMethod} = require('tcp-http-client'); | ||
const { URL } = require('url'); | ||
@@ -17,0 +18,0 @@ const client = new TCPHttpClient(); |
@@ -8,3 +8,3 @@ const { URL } = require('url'); | ||
this.content = null; | ||
this.httpMethod = httpMethod; | ||
this.httpMethod = this.checkHttpMethod(httpMethod); | ||
this.keepAlive = true; | ||
@@ -26,2 +26,11 @@ this.addHeader("host", url.hostname) | ||
checkHttpMethod(httpMethod){ | ||
if (Object.values(TCPHttpMethod).includes(httpMethod)){ | ||
return httpMethod; | ||
} | ||
else { | ||
throw new Error("Invalid Http Method Specified"); | ||
} | ||
} | ||
addCookie(cookieName, cookieValue){ | ||
@@ -28,0 +37,0 @@ this.cookies.push({ name: cookieName, value: cookieValue }) |
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
43369
935
95