- Change
Request.hijack
return type fromvoid
toNever
. This may cause analysis hints in packages using this method, but is not actually breaking for apps.
- Stable null safety release.
- Update to support Dart null-safety.
- Updated the
change
function onRequest
andResponse
to clear existing values incontext
if the providedcontext
value hasnull
values.
- Allow a
handlerPath
to lead up to a double//
in a URI.
- Handle malformed URLs (400 instead of 500).
- Fix internal error in
Request
when.change()
matches the full path.
- Supports multiple header values in
Request
andResponse
:headersAll
field contains all the header valuesheaders
field contains the same values as previously (appending values with,
)headers
parameter in the constructor and in the.change()
method accepts bothString
andList<String>
values.
- Return the correct HTTP status code for badly formatted requests.
- Allow
stream_channel
version 2.x
- Allow passing
shared
parameter to underlyingHttpServer.bind
calls viashelf_io.serve
. - Correctly pass
encoding
inResponse
constructorsforbidden
,notFound
, andinternalServerError
. - Update
README.md
to point to latest docs.
- Set max SDK version to
<3.0.0
, and adjust other dependencies.
-
Fix constant evaluation analyzer error in
shelf_unmodifiable_map.dart
. -
Update usage of HTTP constants from the Dart SDK. Now require 2.0.0-dev.61.
- Updated SDK version to 2.0.0-dev.55.0.
- Fix some Dart 2 runtime errors.
-
Update
createMiddleware
arguments to useFutureOr
.- Note: this change is not breaking for the runtime behavior, but it might cause new errors during static analysis due the the type changes.
-
Updated minimum Dart SDK to
1.24.0
, which addedFutureOr
. -
Improved formatting of the
logRequests
default logger.
- The
shelf_io
server now adds ashelf.io.connection_info
field toRequest.context
, which provides access to the underlyingHttpConnectionInfo
object.
-
Give a return type to the
Handler
typedef. This may cause static warnings where there previously were none, but all handlers should have already been returning aResponse
orFuture<Response>
. -
Remove
HijackCallback
andOnHijackCallback
typedefs. -
Breaking: Change type of
onHijack
in theRequest
constructor to take an argument ofStreamChannel
.
- Add a
securityContext
parameter toself_io.serve()
.
-
Go back to auto-generating a
Content-Length
header when the length is known ahead-of-time and the user hasn't explicitly specified aTransfer-Encoding: chunked
. -
Clarify adapter requirements around transfer codings.
-
Make
shelf_io
consistent with the clarified adapter requirements. In particular, it removes theTransfer-Encoding
header from chunked requests, and it doesn't apply additional chunking to responses that already declareTransfer-Encoding: chunked
.
- Never auto-generate a
Content-Length
header.
-
Add
Request.isEmpty
andResponse.isEmpty
getters which indicate whether a message has an empty body. -
Don't automatically generate
Content-Length
headers on messages where they may not be allowed. -
User-specified
Content-Length
headers now always take precedence over automatically-generated headers.
-
Allow
List<int>
s to be passed as request or response bodies. -
Requests and responses now automatically set
Content-Length
headers when the body length is known ahead of time. -
Work around sdk#27660 by manually setting
HttpResponse.chunkedTransferEncoding
tofalse
for requests known to have no content.
- Improve the documentation of
logRequests()
.
- Support
http_parser
3.0.0.
- Fix all strong-mode warnings and errors.
-
Request.hijack()
now takes a callback that accepts a singleStreamChannel
argument rather than separateStream
andStreamSink
arguments. The old callback signature is still supported, but should be considered deprecated. -
The
HijackCallback
andOnHijackCallback
typedefs are deprecated.
- Support
http_parser
2.0.0.
- Fix a bug where the
Content-Type
header didn't interact properly with theencoding
parameter fornew Request()
andnew Response()
if it wasn't lowercase.
- When the
shelf_io
adapter detects an error, print the request context as well as the error itself.
-
Add a
Server
interface representing an adapter that knows its own URL. -
Add a
ServerHandler
class that exposes aServer
backed by aHandler
. -
Add an
IOServer
class that implementsServer
in terms ofdart:io
'sHttpServer
.
- Cleaned up handling of certain
Map
instances and related dependencies.
- Messages returned by
Request.change()
andResponse.change()
are marked read whenever the original message is read, and vice-versa. This means that it's possible to read a message on whichchange()
has been called and to callchange()
on a message more than once, as long asread()
is called on only one of those messages.
- Support
http_parser
1.0.0.
- Added a
body
named argument tochange
method onRequest
andResponse
.
-
Updated minimum SDK to
1.9.0
. -
Allow an empty
url
parameter to be passed in tonew Request()
. This fits the stated semantics of the class, and should not have been forbidden.
logRequests
outputs a better message a request has a query string.
- Don't throw a bogus exception for
null
responses.
-
shelf_io
now takes a"shelf.io.buffer_output"
Response.context
parameter that controlsHttpResponse.bufferOutput
. -
Fixed spelling errors in README and code comments.
Breaking change: The semantics of Request.scriptName
and
Request.url
have been overhauled, and the former has been renamed to
Request.handlerPath
. handlerPath
is now the root-relative URL
path to the current handler, while url
's path is the relative path from the
current handler to the requested. The new semantics are easier to describe and
to understand.
Practically speaking, the main difference is that the /
at the beginning of
url
's path has been moved to the end of handlerPath
. This makes url
's path
easier to parse using the path
package.
Request.change
's handling of handlerPath
and url
has also
changed. Instead of taking both parameters separately and requiring that the
user manually maintain all the associated guarantees, it now takes a single
path
parameter. This parameter is the relative path from the current
handlerPath
to the next one, and sets both handlerPath
and url
on the new
Request
accordingly.
- Updated
Request
to support thebody
model fromResponse
.
-
Fixed
createMiddleware
to only catch errors iferrorHandler
is provided. -
Updated
handleRequest
inshelf_io
to more gracefully handle errors when parsingHttpRequest
.
- Updated
Request.change
to include the originalonHijack
callback if one exists.
-
Added default body text for
Response.forbidden
andResponse.notFound
if null is provided. -
Clarified documentation on a number of
Response
constructors. -
Updated
README
links to point to latest docs.
- Widen the version constraint on the
collection
package.
- Updated headers map to use a more efficient case-insensitive backing store.
- Widen the version constraint for
stack_trace
.
-
The
shelf_io
adapter now sends theDate
HTTP header by default. -
Fixed logic for setting Server header in
shelf_io
.
- Add new named parameters to
Request.change
:scriptName
andurl
.
-
Add a
Cascade
helper that runs handlers in sequence until one returns a response that's neither a 404 nor a 405. -
Add a
Request.change
method that copies a request with new header values. -
Add a
Request.hijack
method that allows handlers to gain access to the underlying HTTP socket.
-
Capture all asynchronous errors thrown by handlers if they would otherwise be top-leveled.
-
Add more detail to the README about handlers, middleware, and the rules for implementing an adapter.
- Add a
context
map toRequest
andResponse
for passing data among handlers and middleware.
- Allow
scheduled_test
development dependency up to v0.12.0
- Renamed
Stack
toPipeline
.
-
Access to headers for
Request
andResponse
is now case-insensitive. -
The constructor for
Request
has been simplified. -
Request
now exposesurl
which replacespathInfo
,queryString
, andpathSegments
.
-
Removed old testing infrastructure.
-
Updated documentation address.
- Added a dependency on the
http_parser
package.
- Removed unused dependency on the
mime
package.
- Added a dependency on the
string_scanner
package.
- Updated
pubspec
details for move to Dart SDK.
Response
- NEW!
int get contentLength
- NEW!
DateTime get expires
- NEW!
DateTime get lastModified
- NEW!
Request
- BREAKING
contentLength
is now read fromheaders
. The constructor argument has been removed. - NEW! supports an optional
Stream<List<int>> body
constructor argument. - NEW!
Stream<List<int>> read()
andFuture<String> readAsString([Encoding encoding])
- NEW!
DateTime get ifModifiedSince
- NEW!
String get mimeType
- NEW!
Encoding get encoding
- BREAKING
- BREAKING Removed
Shelf
prefix from all classes. - BREAKING
Response
has drastically different constructors. - NEW!
Response
now accepts a body of eitherString
orStream<List<int>>
. - NEW!
Response
now exposesencoding
andmimeType
.
- First reviewed release