http-source
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -153,2 +153,24 @@ "use strict"; | ||
}; | ||
this.httpPatch = function (urlPath, body, headers) { | ||
if (headers === void 0) { headers = {}; } | ||
return __awaiter(_this, void 0, void 0, function () { | ||
var response, err_5, error; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
_a.trys.push([0, 2, , 3]); | ||
return [4, this.remote.patch(urlPath, body, { headers: _.merge({}, { 'Content-Type': this.defaultContentType }, this.globalHeaders, headers) })]; | ||
case 1: | ||
response = _a.sent(); | ||
return [2, response.data]; | ||
case 2: | ||
err_5 = _a.sent(); | ||
error = this.ErrorParser(err_5); | ||
this.onHttpError.dispatch(error); | ||
throw error; | ||
case 3: return [2]; | ||
} | ||
}); | ||
}); | ||
}; | ||
this.remote = axios_1.default.create({ baseURL: baseUrl }); | ||
@@ -155,0 +177,0 @@ if (options.request) { |
@@ -24,6 +24,6 @@ | ||
contentType?: string | ||
}, | ||
} | ||
error?: { | ||
parse?: (error: AxiosError) => ErrorInstance | ||
}, | ||
} | ||
} | ||
@@ -47,3 +47,4 @@ | ||
public httpDelete<ResponseBody>(urlPath: string, queryParams: HttpQueryParams, headers?: HttpHeaders): Promise<ResponseBody> | ||
public httpPatch<ResponseBody>(urlPath: string, body: any, headers?: HttpHeaders): Promise<ResponseBody> | ||
} | ||
} |
{ | ||
"name": "http-source", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -110,2 +110,13 @@ | ||
} | ||
public httpPatch = async <ResponseBody>(urlPath: string, body: any, headers: HttpHeaders = {}): Promise<ResponseBody> => { | ||
try { | ||
const response = await this.remote.patch(urlPath, body, { headers: _.merge({}, { 'Content-Type': this.defaultContentType }, this.globalHeaders, headers) }) | ||
return response.data | ||
} catch (err) { | ||
const error = this.ErrorParser(err) | ||
this.onHttpError.dispatch(error) | ||
throw error | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
25935
426
0