mirror of
https://github.com/ading2210/libcurl.js.git
synced 2025-05-13 22:40:01 -04:00
fix handling of request objects when passed into libcurl.fetch
This commit is contained in:
parent
c05ca1769e
commit
294fbd65f3
4 changed files with 13 additions and 3 deletions
|
@ -1,5 +1,8 @@
|
||||||
# Libcurl.js Changelog:
|
# Libcurl.js Changelog:
|
||||||
|
|
||||||
|
## v0.6.7 (3/26/24):
|
||||||
|
- Fix handling of `Request` objects when passed into `libcurl.fetch`
|
||||||
|
|
||||||
## v0.6.6 (3/20/24):
|
## v0.6.6 (3/20/24):
|
||||||
- Fix random segfaults due to an improper invocation of libcurl
|
- Fix random segfaults due to an improper invocation of libcurl
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,14 @@ class HTTPSession extends CurlSession {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async fetch(url, params={}) {
|
async fetch(resource, params={}) {
|
||||||
|
let url = resource;
|
||||||
|
if (resource instanceof Request) {
|
||||||
|
url = resource.url;
|
||||||
|
params.body = params.body || await resource.blob();
|
||||||
|
params.headers = params.headers || Object.fromEntries(resource.headers);
|
||||||
|
params.method = params.method || resource.method;
|
||||||
|
}
|
||||||
let body = await this.constructor.create_options(params);
|
let body = await this.constructor.create_options(params);
|
||||||
return await this.request_async(url, params, body);
|
return await this.request_async(url, params, body);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "libcurl.js",
|
"name": "libcurl.js",
|
||||||
"version": "0.6.6",
|
"version": "0.6.7",
|
||||||
"description": "An experimental port of libcurl to WebAssembly for use in the browser.",
|
"description": "An experimental port of libcurl to WebAssembly for use in the browser.",
|
||||||
"main": "libcurl.mjs",
|
"main": "libcurl.mjs",
|
||||||
"exports": {
|
"exports": {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit ae2ec5f867aa64495e99facfeecf4307ec46d702
|
Subproject commit 351682f7e19c8a7a58d261ba666abaae95f04f6a
|
Loading…
Add table
Add a link
Reference in a new issue