Commit b9f6146
committed
Try to sniff the mime type based on the body content
Synchronous body reader now exposes a peek() function to get the first few bytes
from the response body. This will be no less than 100 bytes (assuming the body
is that big), but could be more. Streaming API, via res.next() continues to work
as-is even if peek() is called.
Introduce Mime.sniff() that detects a few common types - the ones that we care
about right now - from the body content.1 parent 66ec087 commit b9f6146
File tree
5 files changed
+342
-159
lines changed- src
- browser
- xhr
- http
5 files changed
+342
-159
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
435 | 435 | | |
436 | 436 | | |
437 | 437 | | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
| 438 | + | |
448 | 439 | | |
449 | | - | |
450 | | - | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
451 | 446 | | |
452 | 447 | | |
453 | 448 | | |
454 | 449 | | |
455 | | - | |
| 450 | + | |
456 | 451 | | |
457 | 452 | | |
458 | 453 | | |
| |||
0 commit comments