aboutsummaryrefslogtreecommitdiff
path: root/test/js/web/fetch/fetch.test.ts (follow)
AgeCommit message (Collapse)AuthorFilesLines
2023-09-29Fix hang in `bun install` (#6192)Gravatar Jarred Sumner 1-0/+92
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-09-29fix: don't set default request method when creating a Request (#6154)Gravatar Liz 1-0/+10
In the case of creating a Request with the parameters `(Request, object)`, there was a bug that method and headers are set from the default created by the init rather then the already present value from the request param. This is because for a to me unknown reason the order in which the parameters are processed is reversed. This fixes that by adding a check which stops the defaults from being set, unless they are explicitly passed. Fixes: https://github.com/oven-sh/bun/issues/6144
2023-09-29Fixes #6053 (#6162)Gravatar Jarred Sumner 1-1/+3
Fixes #6053 Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-09-20fix(fetch): fix redirect in relative path location. (#5781)Gravatar Ai Hoshino 1-0/+94
* fix(fetch): fix redirect in relative path location. * fix utf-8 encoding * use server.reload * check buf size * add RedirectURLTooLong test
2023-09-19Align fetch() redirect behavior with spec (#5729)Gravatar Jarred Sumner 1-0/+121
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-09-16fix(fetch) handle 100 continue (#5496)Gravatar Ciro Spaciari 1-0/+60
* handle 100 continue * move comment * cleanup * fmt
2023-09-13fix(node/fetch): Make data URL fetch consistent with node (#5126)Gravatar David Hewitt 1-0/+24
2023-09-05fix ipv6 localhost fetch (#4498)Gravatar Dylan Conway 1-0/+20
* `node` null for localhost getaddrinfo * more test
2023-08-21fetch(stream) add stream support for compressed and uncompressed data (#4127)Gravatar Ciro Spaciari 1-5/+12
* streams non compressed data in 64kb chunks (at least) * fmt * wip remove pause * fix default streaming and buffering * fix atomic lags * fix size * make chunked encoding work again (WIP streaming chunked) * WIP: chunked encoding streaming * fix end of streamings * working streaming + compression * add fixes + tests * fmt + fix proxy * fix oopsies * codegen after merge * fmt + fixes * more fixes * more fixes and logs * avoid double free * check empty before pop * check empty on pop * fix copy to real when complete * remove unnecessary logs * better has_schedule_callback swap, body locked size helper, remove isEmpty from unbounded_queue pop * fix response ref, fix body_size * add deflate support, fix error throw, add more tests * codegen after merge * remove logs, add connection close test * fix macOS build * fix redirect error option * make body_size more clear * support new Reponse(response) * toString DOMWrapper objects properly instead of supporting response in Response constructor * ignore headers with no name, add more tests * oops * handle transform with fetch * add gz image stream test * remove duplicate test * fix missing chunk on macOS under pressure * oops include all OS * some fixes * compare buffers instead of sizes * refactor err.err and protect it
2023-08-07implement fetching data urls (#4000)Gravatar Dylan Conway 1-0/+109
* fetch data urls * `byteSlice` * deinit slice * allocate `mime_type` string if needed * `content_type_allocated` and uncomment tests * `str_` * createAtom and slice decode result
2023-08-07fix iterating headers with `set-cookie` (#4048)Gravatar Dylan Conway 1-5/+13
* fix iterating headers with `set-cookie` * a test * move work to `HTTPHeaderMap::set` * append set-cookie after sort * remove compare function
2023-07-30Fix memory leak in response.clone(), further reduce memory usage of Request ↵Gravatar Jarred Sumner 1-3/+37
& Response (#3902) * Atomize respsone.url & response.statusText * Fix warning * Atomize Request & Response URLs when possible * Fix memory leak in response.clone() bun/bench/snippets on  jarred/atomize ❯ mem bun --smol request-response-clone.mjs cpu: Apple M1 Max runtime: bun 0.7.2 (arm64-darwin) benchmark time (avg) (min … max) p75 p99 p995 -------------------------------------------------------- ----------------------------- req.clone().url 77.3 ns/iter (40.35 ns … 222.64 ns) 91.53 ns 128.11 ns 172.78 ns resp.clone().url 162.43 ns/iter (116 ns … 337.77 ns) 177.4 ns 232.38 ns 262.65 ns Peak memory usage: 60 MB bun/bench/snippets on  jarred/atomize ❯ mem bun-0.7.1 --smol request-response-clone.mjs cpu: Apple M1 Max runtime: bun 0.7.1 (arm64-darwin) benchmark time (avg) (min … max) p75 p99 p995 -------------------------------------------------------- ----------------------------- req.clone().url 115.85 ns/iter (80.35 ns … 247.39 ns) 128.19 ns 181.93 ns 207.23 ns resp.clone().url 252.32 ns/iter (202.6 ns … 351.07 ns) 266.56 ns 325.88 ns 334.73 ns Peak memory usage: 1179 MB * Update tests * Update js_ast.zig * Update test --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-07-28Support file: URLs in `fetch` (#3858)Gravatar Jarred Sumner 1-0/+10
* Support file: URLs in `fetch` * Update url.zig --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-07-06fix query without slash (#3547)Gravatar Ciro Spaciari 1-0/+4
2023-07-02set content-length 0 in some cases (#3503)Gravatar dave caruso 1-0/+19
2023-05-15Fix bug with `req.url` set incorrectly (#2881)Gravatar Jarred Sumner 1-0/+15
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-05-10feat(fetch) add redirect: 'error' support (#2845)Gravatar Ciro Spaciari 1-0/+21
* add redirect: 'error' support * fix typo * fix typo * refactor FetchRedirect enum * fix FetchRedirect * updated
2023-05-10Clean-up 85b4be5f7189e51e63672ddc874e7c6e09ae8befGravatar Jarred Sumner 1-0/+10
- We don't need to make `Bun__fetch` exported in every C++ header file - We shouldn't return JSObjectRef, its an unnecessary wrapper - The version of `fetch` on the Bun global should be non-configurable so that it is safe for anyone who wants to use that without a user-modifiable one
2023-05-10fix(fetch) fix fetch inheritance (#2842)Gravatar Ciro Spaciari 1-0/+5
* patch fetch function inheritance * fmt * fix reserveCapacity and number of arguments for fetch * change Bun.fetch to use Fetch.jsFunction * merge Fetch.jsFunction and Fetch.call * remove commented code
2023-04-06Add last modify field "mtime" for FileBlob (#1431) (#2491)Gravatar Zhongwei Yao 1-0/+1
* Add lastModified field for FileBlob (#1431) lastModified value is epoch timestamp in millisecond unit. * update according to review comment.
2023-03-22A couple bug fixes (#2458)Gravatar Dylan Conway 1-0/+1
* fix valid status code range * update path * highwatermark option * throw DOMException * remove extra transpiler output * more transpiler tests * comment * get index not quickly * replace with `getDirectIndex` * update abort test * throw out of range status code * promisify test fix * move stdio test instance files * working crypto tests * allow duplicate set-cookie headers * different formatting * revert, fix will be in different pr * it is called * use min buffer size * fix url tests * null origin for other protocols * remove overload * add very large file test * await * coerce to int64 * 64 * no cast * add todo blob url tests * use `tryConvertToInt52`
2023-03-22Fix types (#2453)Gravatar Colin McDonnell 1-17/+18
* WIP * WIP * WIP * WIP * Improve typechecking in type files * Fix typechecking * Update * Update submodule * CI for typechecking * Add ci * Update commands * Format after build * Dont use bunx * Rename job * Use nodemodules prettier * Update workflow * Use symlink * Debug * Debug * Clean up and rename jobs
2023-03-19Several bug fixes (#2427)Gravatar Jarred Sumner 1-1/+29
* Fix test * Fix segfault when unexpected type is passed in `expect().toThrow` * Fix issues with request constructor * Don't bother cloning headers when its empty * woops * more tests * fix incorrect test * Make the fetch error messages better * Update response.zig * Fix test that failed on macOS * Fix test * Remove extra hash table lookups * Support running dummy registry directly cc @alexlamsl * Update test * Update test * fixup * Workaround crash in test runner * Fixup test * Fixup test * Update os.test.js --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-03-17Fix various fetch/response/request tests (#2416)Gravatar Dylan Conway 1-11/+176
* fix most fetch tests, skip a few * fastGet, toValueGC, and invalid init * bigint unreachable, range error, log process as process * remove extra fetch_headers * remove js_type parameter, check isObject() * throw invalid mime type error, use enum literal * switch back to promise rejection * RangeError pascal case
2023-03-07Reorganize tests (#2332)Gravatar Ashcon Partovi 1-0/+935