Commit Graph

607 Commits

Author SHA1 Message Date
Gregor Martynus b2f5d8d3fa
ci: semantic-release (#1270)
* ci: semantic-release

* docs(CONTRIBUTING): initial version

* ci(semantic-pull-request): Always validate the PR title, and ignore the commits

* docs(CONTRIBUTING): ammend note on "Create a merge commit" button

* Update CONTRIBUTING.md

* Update semantic.yml
2022-01-20 19:41:36 +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
Linus Unnebäck 92dee097c6
Simplify check in isDomainOrSubdomain (#1455) 2022-01-16 16:08:23 +01:00
Jimmy Wärting 36e47e8a64
3.1.1 release (#1451) 2022-01-16 13:24:18 +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
Jamie Slome f2c3d56375
Create SECURITY.md (#1445) 2022-01-08 14:21:04 +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
dnalborczyk f674875f98
ci: fix main branch (#1429) 2021-12-28 16:39:23 +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
Adam 7ba5bc9e0a
update readme for TS @type/node-fetch (#1405)
Co-authored-by: adamellsworth <adam.d.ellsworth@me.com>
2021-12-06 17:03:27 +01:00
Jimmy Wärting 6956bf868b
core: Don't use buffer to make a blob (#1402) 2021-11-30 10:40:04 +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 0284826de6
fix(http.request): Cast URL to string before sending it to NodeJS core (#1378)
* Add some jsdoc

* cast url to string before sending it to NodeJS core
2021-11-12 12:37:51 +01:00
Jimmy Wärting 3f0e0c2949
docs: Fix typo around sending a file (#1381) 2021-11-12 12:31:29 +01:00
Jimmy Wärting 30c3cfe1d2
update fetch-blob (#1371) 2021-11-10 16:46:19 +01:00
Jimmy Wärting 109bd21313
release minor change (3.1.0) (#1364) 2021-11-08 19:13:47 +01:00
Jimmy Wärting ff71348b7b
docs: Update code examples (#1365)
* remove buffer example

* show example of posting and getting a formdata instance

* recommend using builtin AbortController

* recommend posting blob instead of stream

* we do support formdata
2021-11-08 19:09:18 +01:00
Jimmy Wärting 1068c8a56e
template: Make PR template more task oriented (#1224) 2021-11-08 13:11:04 +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
Ambrose Chua 37ac459cfd
docs: Improve clarity of "Loading and configuring" (#1323)
* docs: Improve clarity of "Loading and configuring"

* Update README.md

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

Co-authored-by: Linus Unnebäck <linus@folkdatorn.se>
2021-11-05 13:33:22 +01:00
Jiralite a3a5b6316e
chore: Correct stuff in README.md (#1361) 2021-11-05 13:20:21 +01:00
Clemens Wolff ff7e950359
Add typing for Response.redirect(url, status) (#1169) 2021-11-05 11:31:14 +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
dependabot[bot] 0a672754ce
Bump mocha from 8.4.0 to 9.1.3 (#1339)
Bumps [mocha](https://github.com/mochajs/mocha) from 8.4.0 to 9.1.3.
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mochajs/mocha/compare/v8.4.0...v9.1.3)

---
updated-dependencies:
- dependency-name: mocha
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-04 22:33:53 +01:00
dependabot[bot] 300eb56732
Bump data-uri-to-buffer from 3.0.1 to 4.0.0 (#1319)
Bumps [data-uri-to-buffer](https://github.com/TooTallNate/node-data-uri-to-buffer) from 3.0.1 to 4.0.0.
- [Release notes](https://github.com/TooTallNate/node-data-uri-to-buffer/releases)
- [Commits](https://github.com/TooTallNate/node-data-uri-to-buffer/compare/3.0.1...4.0.0)

---
updated-dependencies:
- dependency-name: data-uri-to-buffer
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-27 12:13:38 +02: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
dnalborczyk 965b323d9c
fix(types): declare buffer() deprecated (#1345) 2021-10-23 11:15:24 +02:00
Daniel Hritzkiv 4972e00905
docs: switch url to URL
Consistent capitalization of 'URL'
2021-10-07 12:25:54 +02:00
Dan Fernandez 52b743b4f0
Update README.md to fix HTTPResponseError (#1135)
In the 'Handling client and server errors', the class HTTPResponseError constructor has to call 'super()' before accessing 'this.response'

Not doing this throws the following exception: "ReferenceError: Must call super constructor in derived class before accessing 'this' or returning from derived constructor"

Fix: This just changes the order so super(...) is first, then this.response...

MDN Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/super#using_super_in_classes
2021-10-07 11:06:38 +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 5756eaaec2
Update CHANGELOG.md (#1292) 2021-10-06 22:00:03 -04:00
robertoaceves 3b99832e23
Add default Host request header to README.md file (#1316)
Mention the Host header in the default request headers table.

According to the standard [RFC 7230 Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing |https://httpwg.org/specs/rfc7230.html#header.host]
    "A client MUST send a Host header field in all HTTP/1.1 request messages."
2021-09-27 19:06:05 +02: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
David Adi Nugroho 9cd2e43e62
Fix octocat image link (#1281)
Co-authored-by: Richie Bendall <richiebendall@gmail.com>
2021-09-10 00:20:08 +12: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
Jimmy Wärting 471f08c15c
fix(Body): Discurage form-data and buffer() (#1212)
warn about using form-data
2021-09-05 01:14:38 +02:00
Jimmy Wärting 2603c67f18
V3 stable release (#1257)
* making v3 stable
2021-08-31 17:54:19 +02:00
Jimmy Wärting 2f1b426a98
docs: Add example for loading ESM from CommonJS (#1236)
* docs: Documented other ways to load ESM

* finegraned -> fine graned

* change require to import

* await response and discourage res.buffer()

* corrected minimum node version required

* updated changelog

* docs: Fix spelling

* docs: encourage v2 from cjs
2021-08-28 02:10:08 +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
Richie Bendall 136a5f1433
Add link to v2 docs (#1202) 2021-08-08 02:42:00 +12: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
Josephus Paye II ffef5e3c23
Fix `this` arg for URLSearchParams prototype call (#1111) 2021-05-04 00:28:50 +02:00
dependabot-preview[bot] 694b11a8ba
Upgrade to GitHub-native Dependabot (#1139)
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2021-05-04 00:14:45 +02:00