Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
e03edc6bbf | |||
03c4340e4c |
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/webrequest",
|
||||
"version": "2.0.1",
|
||||
"version": "2.0.2",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/webrequest",
|
||||
"version": "2.0.1",
|
||||
"version": "2.0.2",
|
||||
"private": false,
|
||||
"description": "securely request from browsers",
|
||||
"main": "dist/index.js",
|
||||
|
10
ts/index.ts
10
ts/index.ts
@ -4,9 +4,8 @@ import * as plugins from './webrequest.plugins';
|
||||
* web request
|
||||
*/
|
||||
export class WebRequest {
|
||||
public async getJson(urlArg: string | string[], requestBody?: any) {
|
||||
public async getJson(urlArg: string | string[]) {
|
||||
const response: Response = await this.request(urlArg, {
|
||||
body: requestBody,
|
||||
method: 'GET'
|
||||
});
|
||||
return response.json();
|
||||
@ -18,7 +17,7 @@ export class WebRequest {
|
||||
public async postJson(urlArg: string, requestBody?: any) {
|
||||
const response: Response = await this.request(urlArg, {
|
||||
body: requestBody,
|
||||
method: 'GET'
|
||||
method: 'POST'
|
||||
});
|
||||
return response.json();
|
||||
}
|
||||
@ -29,7 +28,7 @@ export class WebRequest {
|
||||
public async putJson(urlArg: string, requestBody?: any) {
|
||||
const response: Response = await this.request(urlArg, {
|
||||
body: requestBody,
|
||||
method: 'GET'
|
||||
method: 'PUT'
|
||||
});
|
||||
return response.json();
|
||||
}
|
||||
@ -37,9 +36,8 @@ export class WebRequest {
|
||||
/**
|
||||
* put js
|
||||
*/
|
||||
public async deleteJson(urlArg: string, requestBody?: any) {
|
||||
public async deleteJson(urlArg: string) {
|
||||
const response: Response = await this.request(urlArg, {
|
||||
body: requestBody,
|
||||
method: 'GET'
|
||||
});
|
||||
return response.json();
|
||||
|
Reference in New Issue
Block a user