Releases: mjackson/remix-the-web
Releases · mjackson/remix-the-web
tar-parser v0.2.0
- Fixed a bug that hangs the process when trying to read zero-length entries.
headers v0.9.0
This release tightens up the type safety and brings SuperHeaders
more in line with the built-in Headers
interface.
- BREAKING CHANGE: The mutation methods
headers.set()
andheaders.append()
no longer accept anything other than a string as the 2nd arg. This follows the nativeHeaders
interface more closely.
// before
let headers = new SuperHeaders();
headers.set('Content-Type', { mediaType: 'text/html' });
// after
headers.set('Content-Type', 'text/html');
// if you need the previous behavior, use the setter instead of set()
headers.contentType = { mediaType: 'text/html' };
Similarly, the constructor no longer accepts non-string values in an array init value.
// before
let headers = new SuperHeaders([['Content-Type', { mediaType: 'text/html' }]]);
// after
let headers = new SuperHeaders([['Content-Type', 'text/html']]);
// if you need the previous behavior, use the object init instead
let headers = new SuperHeaders({ contentType: { mediaType: 'text/html' } });
- BREAKING CHANGE:
headers.get()
returnsnull
for uninitialized custom header values instead ofundefined
. This follows the nativeHeaders
interface more closely.
// before
let headers = new SuperHeaders();
headers.get('Host'); // null
headers.get('Content-Type'); // undefined
// after
headers.get('Host'); // null
headers.get('Content-Type'); // null
- BREAKING CHANGE: Removed ability to initialize
AcceptLanguage
withundefined
weight values.
// before
let h1 = new AcceptLanguage({ 'en-US': undefined });
let h2 = new AcceptLanguage([['en-US', undefined]]);
// after
let h3 = new AcceptLanguage({ 'en-US': 1 });
- All setters now also accept
undefined | null
in addition tostring
and custom object values. Setting a header toundefined | null
is the same as usingheaders.delete()
.
let headers = new SuperHeaders({ contentType: 'text/html' });
headers.get('Content-Type'); // 'text/html'
headers.contentType = null; // same as headers.delete('Content-Type');
headers.get('Content-Type'); // null
- Allow setting date headers (
date
,expires
,ifModifiedSince
,ifUnmodifiedSince
, andlastModified
) using numbers.
let ms = new Date().getTime();
let headers = new SuperHeaders({ lastModified: ms });
headers.date = ms;
- Added
AcceptLanguage.prototype.accepts(language)
,AcceptLanguage.prototype.getWeight(language)
,
AcceptLanguage.prototype.getPreferred(languages)
import { AcceptLanguage } from '@mjackson/headers';
let header = new AcceptLanguage({ 'en-US': 1, en: 0.9 });
header.accepts('en-US'); // true
header.accepts('en-GB'); // true
header.accepts('en'); // true
header.accepts('fr'); // false
header.getWeight('en-US'); // 1
header.getWeight('en-GB'); // 0.9
header.getPreferred(['en-GB', 'en-US']); // 'en-US'
- Added
Accept
support
import { Accept } from '@mjackson/headers';
let header = new Accept({ 'text/html': 1, 'text/*': 0.9 });
header.accepts('text/html'); // true
header.accepts('text/plain'); // true
header.accepts('text/*'); // true
header.accepts('image/jpeg'); // false
header.getWeight('text/html'); // 1
header.getWeight('text/plain'); // 0.9
header.getPreferred(['text/html', 'text/plain']); // 'text/html'
- Added
Accept-Encoding
support
import { AcceptEncoding } from '@mjackson/headers';
let header = new AcceptEncoding({ gzip: 1, deflate: 0.9 });
header.accepts('gzip'); // true
header.accepts('deflate'); // true
header.accepts('identity'); // true
header.accepts('br'); // false
header.getWeight('gzip'); // 1
header.getWeight('deflate'); // 0.9
header.getPreferred(['gzip', 'deflate']); // 'gzip'
- Added
SuperHeaders.prototype
(getters and setters) for:accept
acceptEncoding
acceptRanges
connection
contentEncoding
contentLanguage
etag
host
location
referer
multipart-parser v0.7.2
- Fix dependency on
headers
in package.json
form-data-parser v0.5.1
- Fix dependency on
headers
in package.json
node-fetch-server v0.5.0
- Expose
createHeaders(req: http.IncomingMessage): Headers
API for creating headers from the headers of incoming request objects. - Update
sendResponse
to use an object to add support for libraries such as express while maintainingnode:http
andnode:https
compatibility.
multipart-parser v0.7.1
- Re-export everything from
multipart-parser/node
. If you're usingmultipart-parser/node
, you shouldimport
everything from there. Don't import anything frommultipart-parser
.
tar-parser v0.1.0
- Initial release
node-fetch-server v0.4.1
- Fix low-level API example in the README