| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 5869275 commit 30dc6dd
23 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -489,6 +489,8 @@ The `RequestOptions.method` property should not be value `'CONNECT'`. | |||
| 489 | 489 | - `body` | |
| 490 | 490 | - `bodyUsed` | |
| 491 | 491 | ||
| 492 | + `body` can not be consumed twice. For example, calling `text()` after `json()` throws `TypeError`. | ||
| 493 | + | ||
| 492 | 494 | `body` contains the following additional extensions: | |
| 493 | 495 | ||
| 494 | 496 | - `dump({ limit: Integer })`, dump the response by reading up to `limit` bytes without killing the socket (optional) - Default: 262144. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -20,7 +20,7 @@ const kFactory = Symbol('factory') | |||
| 20 | 20 | const kOptions = Symbol('options') | |
| 21 | 21 | ||
| 22 | 22 | function defaultFactory (origin, opts) { | |
| 23 | - return new Pool(origin, opts); | ||
| 23 | + return new Pool(origin, opts) | ||
| 24 | 24 | } | |
| 25 | 25 | ||
| 26 | 26 | class BalancedPool extends PoolBase { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -794,7 +794,7 @@ class Parser { | |||
| 794 | 794 | return -1 | |
| 795 | 795 | } | |
| 796 | 796 | ||
| 797 | - /* istanbul ignore if: this can only happen if server is misbehaving */ | ||
| 797 | + /* this can only happen if server is misbehaving */ | ||
| 798 | 798 | if (upgrade && !request.upgrade) { | |
| 799 | 799 | util.destroy(socket, new SocketError('bad upgrade', util.getSocketInfo(socket))) | |
| 800 | 800 | return -1 | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,7 +25,7 @@ function buildConnector ({ maxCachedSessions, socketPath, timeout, ...opts }) { | |||
| 25 | 25 | let socket | |
| 26 | 26 | if (protocol === 'https:') { | |
| 27 | 27 | if (!tls) { | |
| 28 | - tls = require('tls') | ||
| 28 | + tls = require('tls') | ||
| 29 | 29 | } | |
| 30 | 30 | servername = servername || options.servername || util.getServerName(host) || null | |
| 31 | 31 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -201,7 +201,7 @@ function parseHeaders (headers, obj = {}) { | |||
| 201 | 201 | } | |
| 202 | 202 | ||
| 203 | 203 | function parseRawHeaders (headers) { | |
| 204 | - return headers.map(header => header.toString()); | ||
| 204 | + return headers.map(header => header.toString()) | ||
| 205 | 205 | } | |
| 206 | 206 | ||
| 207 | 207 | function isBuffer (buffer) { | |
@@ -263,15 +263,15 @@ function isErrored (body) { | |||
| 263 | 263 | stream.isErrored | |
| 264 | 264 | ? stream.isErrored(body) | |
| 265 | 265 | : /state: 'errored'/.test(nodeUtil.inspect(body) | |
| 266 | - ))) | ||
| 266 | + ))) | ||
| 267 | 267 | } | |
| 268 | 268 | ||
| 269 | 269 | function isReadable (body) { | |
| 270 | 270 | return !!(body && ( | |
| 271 | 271 | stream.isReadable | |
| 272 | 272 | ? stream.isReadable(body) | |
| 273 | 273 | : /state: 'readable'/.test(nodeUtil.inspect(body) | |
| 274 | - ))) | ||
| 274 | + ))) | ||
| 275 | 275 | } | |
| 276 | 276 | ||
| 277 | 277 | function getSocketInfo (socket) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -227,22 +227,20 @@ function percentDecode (input) { | |||
| 227 | 227 | // 1. If byte is not 0x25 (%), then append byte to output. | |
| 228 | 228 | if (byte !== 0x25) { | |
| 229 | 229 | output.push(byte) | |
| 230 | - } | ||
| 231 | 230 | ||
| 232 | 231 | // 2. Otherwise, if byte is 0x25 (%) and the next two bytes | |
| 233 | 232 | // after byte in input are not in the ranges | |
| 234 | 233 | // 0x30 (0) to 0x39 (9), 0x41 (A) to 0x46 (F), | |
| 235 | 234 | // and 0x61 (a) to 0x66 (f), all inclusive, append byte | |
| 236 | 235 | // to output. | |
| 237 | - else if ( | ||
| 236 | + } else if ( | ||
| 238 | 237 | byte === 0x25 && | |
| 239 | 238 | !/^[0-9A-Fa-f]{2}$/i.test(String.fromCharCode(input[i + 1], input[i + 2])) | |
| 240 | 239 | ) { | |
| 241 | 240 | output.push(0x25) | |
| 242 | - } | ||
| 243 | 241 | ||
| 244 | 242 | // 3. Otherwise: | |
| 245 | - else { | ||
| 243 | + } else { | ||
| 246 | 244 | // 1. Let bytePoint be the two bytes after byte in input, | |
| 247 | 245 | // decoded, and then interpreted as hexadecimal number. | |
| 248 | 246 | const nextTwoBytes = String.fromCharCode(input[i + 1], input[i + 2]) | |
@@ -334,7 +332,7 @@ function parseMIMEType (input) { | |||
| 334 | 332 | // whitespace from input given position. | |
| 335 | 333 | collectASequenceOfCodePoints( | |
| 336 | 334 | // https://fetch.spec.whatwg.org/#http-whitespace | |
| 337 | - (char) => /(\u000A|\u000D|\u0009|\u0020)/.test(char), | ||
| 335 | + (char) => /(\u000A|\u000D|\u0009|\u0020)/.test(char), // eslint-disable-line | ||
| 338 | 336 | input, | |
| 339 | 337 | position | |
| 340 | 338 | ) | |
@@ -389,10 +387,9 @@ function parseMIMEType (input) { | |||
| 389 | 387 | input, | |
| 390 | 388 | position | |
| 391 | 389 | ) | |
| 392 | - } | ||
| 393 | 390 | ||
| 394 | 391 | // 9. Otherwise: | |
| 395 | - else { | ||
| 392 | + } else { | ||
| 396 | 393 | // 1. Set parameterValue to the result of collecting | |
| 397 | 394 | // a sequence of code points that are not U+003B (;) | |
| 398 | 395 | // from input, given position. | |
@@ -421,7 +418,7 @@ function parseMIMEType (input) { | |||
| 421 | 418 | parameterName.length !== 0 && | |
| 422 | 419 | /^[!#$%&'*+-.^_|~A-z0-9]+$/.test(parameterName) && | |
| 423 | 420 | // https://mimesniff.spec.whatwg.org/#http-quoted-string-token-code-point | |
| 424 | - !/^(\u0009|\x{0020}-\x{007E}|\x{0080}-\x{00FF})+$/.test(parameterValue) && | ||
| 421 | + !/^(\u0009|\x{0020}-\x{007E}|\x{0080}-\x{00FF})+$/.test(parameterValue) && // eslint-disable-line | ||
| 425 | 422 | !mimeType.parameters.has(parameterName) | |
| 426 | 423 | ) { | |
| 427 | 424 | mimeType.parameters.set(parameterName, parameterValue) | |
@@ -436,7 +433,7 @@ function parseMIMEType (input) { | |||
| 436 | 433 | /** @param {string} data */ | |
| 437 | 434 | function forgivingBase64 (data) { | |
| 438 | 435 | // 1. Remove all ASCII whitespace from data. | |
| 439 | - data = data.replace(/[\u0009\u000A\u000C\u000D\u0020]/g, '') | ||
| 436 | + data = data.replace(/[\u0009\u000A\u000C\u000D\u0020]/g, '') // eslint-disable-line | ||
| 440 | 437 | ||
| 441 | 438 | // 2. If data’s code point length divides by 4 leaving | |
| 442 | 439 | // no remainder, then: | |
@@ -529,10 +526,9 @@ function collectAnHTTPQuotedString (input, position, extractValue) { | |||
| 529 | 526 | ||
| 530 | 527 | // 3. Advance position by 1. | |
| 531 | 528 | position.position++ | |
| 532 | - } | ||
| 533 | 529 | ||
| 534 | 530 | // 6. Otherwise: | |
| 535 | - else { | ||
| 531 | + } else { | ||
| 536 | 532 | // 1. Assert: quoteOrBackslash is U+0022 ("). | |
| 537 | 533 | assert(quoteOrBackslash === '"') | |
| 538 | 534 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,6 +13,7 @@ class File extends Blob { | |||
| 13 | 13 | ||
| 14 | 14 | // 1. Let bytes be the result of processing blob parts given fileBits and | |
| 15 | 15 | // options. | |
| 16 | + // TODO | ||
| 16 | 17 | ||
| 17 | 18 | // 2. Let n be the fileName argument to the constructor. | |
| 18 | 19 | const n = fileName | |
@@ -42,6 +43,7 @@ class File extends Blob { | |||
| 42 | 43 | // F.name is set to n. | |
| 43 | 44 | // F.type is set to t. | |
| 44 | 45 | // F.lastModified is set to d. | |
| 46 | + // TODO | ||
| 45 | 47 | ||
| 46 | 48 | super(fileBits, { type: t }) | |
| 47 | 49 | this[kState] = { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -329,7 +329,7 @@ function fetching ({ | |||
| 329 | 329 | processResponse, | |
| 330 | 330 | processResponseEndOfBody, | |
| 331 | 331 | processResponseConsumeBody, | |
| 332 | - useParallelQueue = false, | ||
| 332 | + useParallelQueue = false | ||
| 333 | 333 | }) { | |
| 334 | 334 | // 1. Let taskDestination be null. | |
| 335 | 335 | let taskDestination = null | |
@@ -762,16 +762,16 @@ async function schemeFetch (fetchParams) { | |||
| 762 | 762 | switch (scheme) { | |
| 763 | 763 | case 'about:': { | |
| 764 | 764 | // If request’s current URL’s path is the string "blank", then return a new response | |
| 765 | - // whose status message is `OK`, header list is « (`Content-Type`, `text/html;charset=utf-8`) », | ||
| 766 | - // and body is the empty byte sequence. | ||
| 765 | + // whose status message is `OK`, header list is « (`Content-Type`, `text/html;charset=utf-8`) », | ||
| 766 | + // and body is the empty byte sequence. | ||
| 767 | 767 | if (path === 'blank') { | |
| 768 | 768 | const resp = makeResponse({ | |
| 769 | 769 | statusText: 'OK', | |
| 770 | 770 | headersList: [ | |
| 771 | 771 | 'content-type', 'text/html;charset=utf-8' | |
| 772 | 772 | ] | |
| 773 | 773 | }) | |
| 774 | - | ||
| 774 | + | ||
| 775 | 775 | resp.urlList = [new URL('about:blank')] | |
| 776 | 776 | return resp | |
| 777 | 777 | } | |
@@ -784,12 +784,12 @@ async function schemeFetch (fetchParams) { | |||
| 784 | 784 | ||
| 785 | 785 | context.on('terminated', onRequestAborted) | |
| 786 | 786 | ||
| 787 | - // 1. Run these steps, but abort when the ongoing fetch is terminated: | ||
| 787 | + // 1. Run these steps, but abort when the ongoing fetch is terminated: | ||
| 788 | 788 | // 1a. Let blob be request’s current URL’s blob URL entry’s object. | |
| 789 | 789 | // https://w3c.github.io/FileAPI/#blob-url-entry | |
| 790 | 790 | // P.S. Thank God this method is available in node. | |
| 791 | 791 | const currentURL = requestCurrentURL(request) | |
| 792 | - | ||
| 792 | + | ||
| 793 | 793 | // https://github.com/web-platform-tests/wpt/blob/7b0ebaccc62b566a1965396e5be7bb2bc06f841f/FileAPI/url/resources/fetch-tests.js#L52-L56 | |
| 794 | 794 | // Buffer.resolveObjectURL does not ignore URL queries. | |
| 795 | 795 | if (currentURL.search.length !== 0) { | |
@@ -803,7 +803,7 @@ async function schemeFetch (fetchParams) { | |||
| 803 | 803 | return makeNetworkError('invalid method') | |
| 804 | 804 | } | |
| 805 | 805 | ||
| 806 | - // 3a. Let response be a new response whose status message is `OK`. | ||
| 806 | + // 3a. Let response be a new response whose status message is `OK`. | ||
| 807 | 807 | const response = makeResponse({ statusText: 'OK', urlList: [currentURL] }) | |
| 808 | 808 | ||
| 809 | 809 | // 4a. Append (`Content-Length`, blob’s size attribute value) to response’s header list. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,6 +8,7 @@ const util = require('../core/util') | |||
| 8 | 8 | const { | |
| 9 | 9 | isValidHTTPToken, | |
| 10 | 10 | EnvironmentSettingsObject, | |
| 11 | + sameOrigin, | ||
| 11 | 12 | toUSVString | |
| 12 | 13 | } = require('./util') | |
| 13 | 14 | const { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -214,10 +214,9 @@ function appendRequestOriginHeader (request) { | |||
| 214 | 214 | if (serializedOrigin) { | |
| 215 | 215 | request.headersList.append('Origin', serializedOrigin) | |
| 216 | 216 | } | |
| 217 | - } | ||
| 218 | 217 | ||
| 219 | 218 | // 3. Otherwise, if request’s method is neither `GET` nor `HEAD`, then: | |
| 220 | - else if (request.method !== 'GET' && request.method !== 'HEAD') { | ||
| 219 | + } else if (request.method !== 'GET' && request.method !== 'HEAD') { | ||
| 221 | 220 | // 1. Switch on request’s referrer policy: | |
| 222 | 221 | switch (request.referrerPolicy) { | |
| 223 | 222 | case 'no-referrer': | |
@@ -307,7 +306,7 @@ function sameOrigin (A, B) { | |||
| 307 | 306 | // 1. If A and B are the same opaque origin, then return true. | |
| 308 | 307 | // "opaque origin" is an internal value we cannot access, ignore. | |
| 309 | 308 | ||
| 310 | - // 2. If A and B are both tuple origins and their schemes, | ||
| 309 | + // 2. If A and B are both tuple origins and their schemes, | ||
| 311 | 310 | // hosts, and port are identical, then return true. | |
| 312 | 311 | if (A.protocol === B.protocol && A.hostname === B.hostname && A.port === B.port) { | |
| 313 | 312 | return true | |
| Back | FazBrowse Home | New Git URL |
0 commit comments