Commit Graph

218 Commits

Author SHA1 Message Date
Khafra 55a4870ae5
feat: add static Response.json (#1670)
* feat: add static Response.json

* fix: set content-type if it doesn't exist properly
2022-11-10 22:46:51 +01:00
Max Gerber e87b093fd6
fix(Headers): don't forward secure headers on protocol change (#1599)
* fix(Headers): don't forward secure headers on protocol change

* fix lint
2022-07-18 17:20:30 +02:00
Khafra 11b7033611
fix: possibly flaky test (#1523) 2022-07-12 18:31:49 +02:00
Alex Kondratyuk 004b3ac832
fix: don't uppercase unknown methods (#1542)
* fix: don't uppercase unknown methods
2022-04-28 11:33:26 +02:00
Jimmy Wärting 6425e2021a
fix: handle bom in text and json (#1482)
* fix: handle bom in text and json

* add test for text and arraybuffer as well
2022-03-11 22:49:14 +01:00
Jimmy Wärting 81b1378bb3
feat: export Blob, File and FormData + utilities (#1463)
* feat: export FormData, Blob and Files

* use import from index instead

* sort a-z

* explicit export

* bump version

* xo lint
2022-01-20 21:42:44 +01:00
Jimmy Wärting 015798edc6
test: Modernize and convert some test in `main.js` to async/await (#1456)
* convert some test to async/await

* Update main.js

* use await

Co-authored-by: Linus Unnebäck <linus@folkdatorn.se>

* take back should accept custom HoSt header

* remove trailing space

Co-authored-by: Linus Unnebäck <linus@folkdatorn.se>
2022-01-17 21:48:43 +01:00
Jimmy Wärting 1028f83708
test: Update major busboy version (#1457)
* test: update busboy

* make linter happy
2022-01-17 16:37:55 +01:00
Maciej Goszczycki dd2cea4672
Handle zero-length OK deflate responses (master) (#965)
* Handle zero-length OK deflate responses

* Also handle pump callback in the deflate branch

* Update the use of pump everywhere and link to the original PR

* Address lints
2022-01-17 00:41:37 +01:00
Travis D. Warlick, Jr 5304f3f7f7
Don't change relative location header on manual redirect (#1105)
* Don't change relative location header on manual redirect

* c8 ignores for node-version-specific code and fix c8 ignore in Headers constructor
2022-01-15 22:08:16 +01:00
Jimmy Wärting f5d3cf5e25
fix(Headers): don't forward secure headers to 3th party (#1449)
* fix(Headers): don't forward secure headers to 3th party
* added more narrow test for isDomainOrSubdomain
2022-01-14 15:55:41 +01:00
Jimmy Wärting 4ae35388b0
core: Warn when using data (#1421)
* Add a warning when using .data in RequestInit

* Add a warning when using .data in Response

* Switch custom solution for utils.deprecate

* Remove unused line in request tests

* moved error handler into the body class

* lint fix

Co-authored-by: Lubomir <lubomir.yudenko@gmail.com>
2022-01-08 14:19:27 +01:00
dnalborczyk 41f53b9065
fix: use more node: protocol imports (#1428)
* fix: use node: protocol

* use node: protocol in readme
2021-12-28 16:39:53 +01:00
Jimmy Wärting 1493d046bc
core: Don't use global buffer (#1422)
* remove unused file

* two test is coveraged by the Uint8Array test

* use arrayBuffer to test base64 instead

* avoid testing buffer

* avoid using Buffer

* import buffer module

* use one same textEncoder

* import stream consumer that can test iterable objects

* fix a test

* fix test where type should be empty
2021-12-21 20:34:30 +01:00
Maxim Shirshin eb33090b81
Chore: Fix logical operator priority (regression) to disallow GET/HEAD with non-empty body (#1369) 2021-12-06 17:14:42 +01:00
Tasos Bitsios 6e4c1e4f67
fix(Redirect): Better handle wrong redirect header in a response (#1387)
* Fixed crash when an invalid Location URL is returned from a redirect. Fixes #1386

* CHANGELOG entry

* changed catch(e) -> catch(error) to match rest of code, added comment

Co-authored-by: Linus Unnebäck <linus@folkdatorn.se>

* suppress error on invalid redirect URL when options.redirect == manual

Co-authored-by: Tasos Bitsios <tasos.bitsios@import.io>
Co-authored-by: Linus Unnebäck <linus@folkdatorn.se>
2021-11-26 11:19:25 +01:00
Dmitry Merkulov 2d5399ed56
fix: handle errors from the request body stream (#1392)
* fix: handle errors from the request body stream

* lint: fix linting

Co-authored-by: Linus Unnebäck <linus@folkdatorn.se>
2021-11-19 14:40:51 +01:00
Jimmy Wärting 3944f24770
feat(Body): Added support for `BodyMixin.formData()` and constructing bodies with FormData (#1314)
Added support for body toFormData
2021-11-08 12:51:49 +01:00
Travis D. Warlick, Jr 2d80b0bb3f
Add support for Referrer and Referrer Policy (#1057)
* Support referrer and referrerPolicy

* Test TS types for addition of referrer and referrerPolicy

* Fix lint issues and merge error
2021-11-05 10:26:13 +01:00
dnalborczyk 47d9cde0b0
refactor: use node: prefix for imports (#1346)
* refactor: use node: prefix for imports
2021-10-26 11:06:52 +02:00
dnalborczyk 96f9ae27c9
chore: fix lint (#1348) 2021-10-23 12:49:37 +02:00
David Kingdon acc2cbaebd
Update response.js (#1162)
Allow Response.clone() to persist the high water mark
2021-10-06 22:07:24 -04:00
Jimmy Wärting 8721d79208
fix(Body.body): Normalize `Body.body` into a `node:stream` (#924)
* body conversion and test

* also handle blobs

* typeof null is object

* test for blob also

* lowercase boundary are easier

* unreachable code, body should never be a blob or buffer any more.

* stream singleton

* use let

* typo

* convert blob stream into a whatwg stream

* lint fix

* update changelog

Co-authored-by: Antoni Kepinski <xxczaki@pm.me>
2021-09-14 11:39:33 +02:00
Ambrose Chua 8b54ab4509
fix: Pass url string to http.request (#1268)
* fix: IPv6 literal parsing

* docs: Explain why search is overwritten

* test: Document the reason for square brackets

* docs: Mention basic auth support as a difference

* fix: Raise a TypeError when URL includes credentials
2021-09-09 06:02:05 +02:00
Travis D. Warlick, Jr 51861e98a8
Fix(premature close) Redirect failing when response is chunked but empty (#1222)
* Fix redirect failing when response is chunked but empty. #1220 #1064

* Handle chunked responses where the final chunk and EOM code are in separate packets and where there is an additional data chunk in the same packet before the final chunk and EOM code.
2021-08-12 18:37:22 +02:00
Antoni Kepinski b50fbc1057
Require Node.js 12.20.0 and move to ESM (#1141)
* Use ESM import in runkit example file

* Update dependencies, version and transition to ESM

* Use ESM imports, add ESM-related info

* Remove rollup

* Lint TypeScript-related files

* Update dependency

* Lint & update dependency

* Lint

* Remove commonjs tests

* chore: update changelog

* Remove commonjs GitHub action

* Update funding.yml

* Update linter rules

* Lint

* Fix tsd

* Remove unnecessary types

* Simplify

* Use top-level await

* Update GitHub Actions

* Use Mocha with ESM

* Revamp

* specify what node version

* update formdata-node dep

* remove lint from example using top await

* updated name and link to formdata-polyfill

* Stop recommend form-data

* filter example - it has many duplicate variables

* Update type definitions to ESM

* Remove unused lint rule disable comment

* Remove leftover rollup and dist folder

* updated depn

* updated d.ts

* lint

* Fix breaking changes with blob v3 stream()

* revert eslint comment

* revert back to xo 0.39

Don't want to deal with all those new rules right now. will fix it later
fixed some of them...

* none TS fan trying to fix type definition

* Give me a break

* Test on all minimum supported Node.js versions (#1170)

* Test on all minimum supported Node.js versions

* Tweak Node.js workaround version range

* Handle Node.js 16 aborted error message

* fix node version string compare

Co-authored-by: Jimmy Wärting <jimmy@warting.se>

* bumped fetch-blob version

* import from dom lib

* rm unused comment

* updated required version in docs

* fixed named import

* set lowest support to 12.20.0

* comment explaining both

* rm log

Co-authored-by: Jimmy Wärting <jimmy@warting.se>
Co-authored-by: Linus Unnebäck <linus@folkdatorn.se>
2021-07-18 22:15:19 +02:00
Tanguy Krotoff 3b50b0c4e6
Add support for Response.error() (#1078) 2021-05-03 23:09:37 +02:00
Travis D. Warlick, Jr d8fc32d6b2
Fully test both AbortController implementations, Bump abortcontroller-polyfill to 1.7.1 (#1065) 2021-03-04 10:01:38 -05:00
Travis D. Warlick, Jr f2ff9ecd04
Test empty status text (#1069) 2021-02-28 15:05:23 -05:00
Travis D. Warlick, Jr 8eeeec18c1
Fix premature close with chunked transfer encoding and for async iterators in Node 12 (#1064)
Co-authored-by: Irakli Gozalishvili <contact@gozala.io>
2021-02-23 07:14:09 +00:00
Leonardo Quixada 6ee9d3186f
Improve Header's forEach method compliance with browser implementation. (#1074)
* Improve Header's forEach method compliance with browser implementation.

* Replaced callback.call with Reflect.apply on Headers' forEach.

* Set undefined as default value for Header' forEach second argument.

* Rewrote test case where 'this' is undefined.

* Ignored lint issues (no-eq-null and eqeqeq).
2021-01-25 19:59:55 -05:00
Travis D. Warlick, Jr 4abbfd231f
Test custom inspect function for `Header` (#1017) 2021-01-01 18:39:48 +13:00
Travis D. Warlick, Jr cb032ea44f
Throw a `TypeError` on an invalid redirect option (#1019) 2021-01-01 18:38:44 +13:00
Travis D. Warlick, Jr 5c657e7990
Fix missing return after reject (#1022)
The bad Location header is escaped by the URL module, so any "corrupted" headers become valid or otherwise cause errors earlier in processing
2021-01-01 18:38:11 +13:00
William Orr 1f4f85e1bb
Support instances of `EventTarget` as a `signal` (#1001)
Co-authored-by: Richie Bendall <richiebendall@gmail.com>
2021-01-01 18:37:26 +13:00
Travis D. Warlick, Jr c86886249a
Allow `signal` to be `null` or `undefined` (#1050) 2021-01-01 18:35:46 +13:00
Antoni Kepinski 38839c53bd
lint 2020-09-05 14:51:31 +02:00
Konstantin Vyatkin 2751bd56eb
allow to run mocha tests in parallel (#880) 2020-06-13 05:34:59 -04:00
Konstantin Vyatkin 96431ed4a1
remove string-to-arraybuffer (#882) 2020-06-13 03:13:50 -04:00
Antoni Kepinski e17cefbb90
Remove duplicated tests (#873)
* move some of the previously deleted tests to the external-encoding.js
2020-06-12 14:06:30 -04:00
Nick K a38b533ad6
feat: Implement form-data encoding (#603)
Co-authored-by: Steve Moser <contact@stevemoser.org>
Co-authored-by: Antoni Kepinski <xxczaki@pm.me>
Co-authored-by: Richie Bendall <richiebendall@gmail.com>
Co-authored-by: Konstantin Vyatkin <tino@vtkn.io>
Co-authored-by: aeb-sia <50743092+aeb-sia@users.noreply.github.com>
Co-authored-by: Nazar Mokrynskyi <nazar@mokrynskyi.com>
Co-authored-by: Erick Calder <e@arix.com>
Co-authored-by: Yaacov Rydzinski <yaacovCR@gmail.com>
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-06-10 22:31:35 +02:00
Richie Bendall e945b6b846
Update logging statement for commonjs artifact testing (#868) 2020-06-10 08:30:07 -04:00
Konstantin Vyatkin 8f406b789a
chore: remove code duplication in custom errors (#842)
* remove code duplication in custom errors

* check using base class
2020-06-10 07:17:35 -04:00
Konstantin Vyatkin 1cb9070cce
[Spec] Should check body _source_ on redirect (#866)
* correct stream tests

* bump Node.JS min to 10.17

* lint
2020-06-10 07:16:51 -04:00
Konstantin Vyatkin df1a4fafa9
fix: Correct Node versions were not installed on test matrix (#846)
* fix Node install and add engines

* use minimum-node-version
2020-06-09 20:26:24 -04:00
Konstantin Vyatkin 69d25b904a
Fix Data URI handling and drop all URL analysis RegExps (#853)
* add breaking test
* don't use RegExp for URLs
2020-05-31 11:15:27 -04:00
Konstantin Vyatkin 769f75d054
Drop custom Promises and refactor to `async` functions (#845)
* refactor to async

* no custsom promises anymore

* restore server premature handler

* simplify

* fixing break

* lint

* remove promise dependency

* fix docs
2020-05-28 23:57:57 +02:00
Konstantin Vyatkin 966a4c3c78
Test CommonJS build artifact (#838)
* common js artefact build

* add GitHub Action
2020-05-26 15:50:51 +02:00
Antoni Kepinski fa627f4b0c
Follow xo linter rules more strictly (#829)
Co-authored-by: Moni <40552237+NotMoni@users.noreply.github.com>
2020-05-25 17:11:56 +02:00
Konstantin Vyatkin ca4703dd15
revamp Headers module (#834)
Co-authored-by: Antoni Kepinski <xxczaki@pm.me>
2020-05-25 16:43:10 +02:00