mirror of
https://github.com/joelwmale/webhook-action.git
synced 2026-08-31 11:14:46 +08:00
feat: updates & github event support
This commit is contained in:
+6
-5
@@ -269,8 +269,8 @@ It is common to create a helper function to check that the response contains no
|
||||
import fetch from 'node-fetch';
|
||||
|
||||
class HTTPResponseError extends Error {
|
||||
constructor(response, ...args) {
|
||||
super(`HTTP Error Response: ${response.status} ${response.statusText}`, ...args);
|
||||
constructor(response) {
|
||||
super(`HTTP Error Response: ${response.status} ${response.statusText}`);
|
||||
this.response = response;
|
||||
}
|
||||
}
|
||||
@@ -400,7 +400,7 @@ console.log(response.headers.raw()['set-cookie']);
|
||||
### Post data using a file
|
||||
|
||||
```js
|
||||
import fetch {
|
||||
import fetch, {
|
||||
Blob,
|
||||
blobFrom,
|
||||
blobFromSync,
|
||||
@@ -539,7 +539,6 @@ If no values are set, the following request headers will be sent automatically:
|
||||
| ------------------- | ------------------------------------------------------ |
|
||||
| `Accept-Encoding` | `gzip, deflate, br` (when `options.compress === true`) |
|
||||
| `Accept` | `*/*` |
|
||||
| `Connection` | `close` _(when no `options.agent` is present)_ |
|
||||
| `Content-Length` | _(automatically calculated, if possible)_ |
|
||||
| `Host` | _(host and port information from the target URI)_ |
|
||||
| `Transfer-Encoding` | `chunked` _(when `req.body` is a stream)_ |
|
||||
@@ -558,6 +557,8 @@ The `agent` option allows you to specify networking related options which are ou
|
||||
|
||||
See [`http.Agent`](https://nodejs.org/api/http.html#http_new_agent_options) for more information.
|
||||
|
||||
If no agent is specified, the default agent provided by Node.js is used. Note that [this changed in Node.js 19](https://github.com/nodejs/node/blob/4267b92604ad78584244488e7f7508a690cb80d0/lib/_http_agent.js#L564) to have `keepalive` true by default. If you wish to enable `keepalive` in an earlier version of Node.js, you can override the agent as per the following code sample.
|
||||
|
||||
In addition, the `agent` option accepts a function that returns `http`(s)`.Agent` instance given current [URL](https://nodejs.org/api/url.html), this is useful during a redirection chain across HTTP and HTTPS protocol.
|
||||
|
||||
```js
|
||||
@@ -627,7 +628,7 @@ results in an [opaque-redirect filtered response](https://fetch.spec.whatwg.org/
|
||||
node-fetch gives you the typical [basic filtered response](https://fetch.spec.whatwg.org/#concept-filtered-response-basic) instead.
|
||||
|
||||
```js
|
||||
const fetch = require('node-fetch');
|
||||
import fetch from 'node-fetch';
|
||||
|
||||
const response = await fetch('https://httpbin.org/status/301', { redirect: 'manual' });
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "node-fetch",
|
||||
"version": "3.2.10",
|
||||
"version": "3.3.2",
|
||||
"description": "A light-weight module that brings Fetch API to node.js",
|
||||
"main": "./src/index.js",
|
||||
"sideEffects": false,
|
||||
|
||||
Reference in New Issue
Block a user