angel3_framework 9.2.0
angel3_framework: ^9.2.0 copied to clipboard
A high-powered HTTP server extensible framework with dependency injection, routing and much more.
Change Log #
9.2.0 #
- feat: Services, hooked services and
@Middlewarelookups now work without reflection; annotations are ignored when no reflector is configured instead of throwing an errror. This enabled support fordart compile exeto be used to build applications without reflection. - feat: Added
Controller(expose: ...)to set the mount path without using reflection through@Exposeannotation - feat: Added
ioc(..., injection: InjectionRequest)for dependency injection without using reflection - feat: Added session timeout (default 20 minutes), idle HTTP/2 sessions are now discarded instead of being kept forever
- feat: Added max size to the content body and rejects larger body with 413 error. The default limit is 10 MB
- feat: Finalizers now run at most once per response
- feat: Added max route cache size (default 1024); the production route cache now evicts least recently used entries.
- feat: Added
ResponseContext.attachmentDisposition()andDriver.closeServer() - fix: An empty JSON array (
[]) in the POST request body no longer causing a 500 errer - fix:
_httpis now nullable and only closed if it was created. - fix: The default error handler now HTML-escapes the exception message and errors (XSS)
- fix:
res.redirect()now escapes the URL in the HTML fallback page and no longer emitsjavascript:,vbscript:ordata:(XSS) - fix:
HookedService.afterAllStream()now emits after-events instead of before-events - fix: A missing
@CookieValuenow uses itsdefaultValueor returns 400, instead of a 500 error - fix:
DELETE /on a service now requests "remove all" (id'null'), subject toallowRemoveAll; services with non-String ids return 405 instead of a 500 error - fix: An HTTP/2 request with a malformed header value (e.g. a bare
%) no longer crashes the server process - fix: HTTP/2 header values are no longer percent-decoded or split on commas
- fix:
req.hostnameover HTTP/2 now comes from the:authorityheader instead of always beinglocalhost - fix: HTTP/2 sessions are now reused across multiple requests via the
DARTSESSIDcookie. Unknown session ids get a new session instead of being adopted - fix: Errors raised while creating a request context, or on an HTTP/2 connection, are now logged instead of terminating the server
- fix:
HostnameRouternow passes route parameters (e.g.:id) to the sub-app's handlers - fix:
HostnameRoutercreates each lazily-built app once, even when several requests arrive before creation finishes - fix:
res.streamFile()with a response encoder (e.g. gzip) no longer sends the uncompressedContent-Length, which crashed the server process - fix: Unbuffered responses with several
write()calls are now compressed as one gzip/deflate stream instead of one per write - fix: Response encoders now skip encodings the client marks
q=0inAccept-Encoding - fix: HTTP/2 server pushes are no longer compressed without a
content-encodingheader - fix: A failure while closing an HTTP/1.1 response is now logged instead of terminating the server
- fix:
responseFinalizersnow run on unbuffered responses, just before headers are sent, so they can set headers, status and cookies. They still run after the handler, with the full body, on buffered responses. Behaviour change: finalizers that readres.buffershould checkres.isBuffered - fix: An invalid response header (e.g. a non-ASCII value) now fails with 500 error, thrown where the header is set
- fix: The HTTP/2
DARTSESSIDsession cookie is nowSecureandHttpOnly - fix: The future returned by
handleRequest/handleRawRequestnow completes after the error response is sent when a handler throws an error, instead of never completing - fix: The
no reflectorstartup message is now logged atinfoinstead ofwarningas it is not longer a mandatory requirement to use Angel3 - fix: When nothing matches, the driver now returns 404 instead of 500
- fix: The application and default logger now prints their record only once. Creating an app with a custom logger, or setting
app.logger, no longer removes the application's ownLogger.rootlisteners - fix:
res.download()no longer sends the file's server path as the download name, encodes any filename safely (RFC 6266), usesapplication/octet-streamfor unknown types instead of crashing, reads the file asynchronously, and returns 404 for a missing file.res.streamFile()also returns 404 for a missing file instead of an error that revealed its path - fix:
startServernow rethrows the original error (e.g. aSocketExceptionwhen the port is in use) instead of a genericArgumentError, and closes the bound server if a startup hook fails - fix:
res.addStream()(and sores.streamFile()) on a buffered response now writes into the buffer, instead of sending directly and leaving the buffer empty - fix:
HEADrequests are now answered by the matchingGETroute, without a body, when no explicitHEADroute exists (RFC 9110), including inHostnameRoutersub-apps. Behaviour change: such requests previously returned 404 or reached a fallback route - fix:
req.accepts()now parses theAcceptheader instead of matching substrings:application/jsonno longer matchesapplication/json-patch+json, type wildcards such astext/*are honoured, and types markedq=0are not accepted - fix: Controller methods named
put…andhead…now map toPUTandHEADroutes. The verb must be a whole word, soposts()orgetter()are nowGET /postsandGET /getter, notPOST /sandGET /ter - refactor: With no container passed, it now falls back to the request's container
- refactor: Resolved various issues with
MapService - refactor: Consolidated multiple copies of the encoder selection logic
9.1.1 #
- Updated README with new links to templates
9.1.0 #
- Require Dart >= 3.13
9.0.0 #
- Require Dart >= 3.12
8.6.0 #
- Require Dart >= 3.8
- Updated
lintsto 6.0.0 - Updated dependencies to the latest release
8.5.0 #
- Require Dart >= 3.6
- Updated
lintsto 5.0.0 - Updated
mimeto 2.0.0 - Fixed res.json() will cause 'Bad state: Cannot modify a closed response.' error.
8.4.0 #
- Require Dart >= 3.3
- Updated
lintsto 4.0.0
8.3.2 #
- Updated README
8.3.1 #
- Updated repository link
8.3.0 #
- Updated
lintsto 3.0.0 - Fixed linter warnings
8.2.0 #
- Add
addResponseHeadertoAngelHttpto add headers to HTTP default response - Add
removeResponseHeadertoAngelHttpto remove headers from HTTP default response
8.1.1 #
- Updated broken image on README
8.1.0 #
- Updated
uuidto 4.0.0
8.0.0 #
- Require Dart >= 3.0
- Updated
httpto 1.0.0
7.0.4 #
- Updated
Exposefields to non-nullable - Updated
Controllerto use non-nullable field
7.0.3 #
- Fixed issue #83. Allow Http request to return null headers instead of throwing an exception.
7.0.2 #
- Added performance benchmark to README
7.0.1 #
- Fixed
BytesBuilderwarnings
7.0.0 #
- Require Dart >= 2.17
6.0.0 #
- Require Dart >= 2.16
- Updated
containerto non nullable - Updated
angelto non nullable - Updated
loggerto non nullable - Refactored error handler
5.0.0 #
- Skipped release
4.2.4 #
- Fixed issue 48. Log not working in development
4.2.3 #
- Fixed
res.json()throwing bad state exception
4.2.2 #
- Added
Dateto response header - Updated
Server: Angel3response header
4.2.1 #
- Updated
package:angel3_container
4.2.0 #
- Updated to
package:belatuk_combinator - Updated to
package:belatuk_merge_map - Updated linter to
package:lints
4.1.3 #
- Updated README
4.1.2 #
- Updated README
- Fixed NNBD issues
4.1.1 #
- Updated link to
Angel3home page - Fixed pedantic warnings
4.1.0 #
- Replaced
http_serverwithbelatuk_http_server
4.0.4 #
- Fixed response returning incorrect status code
4.0.3 #
- Fixed "Primitive after parsed param injection" test case
- Fixed "Cannot remove all unless explicitly set" test case
- Fixed "null" test case
4.0.2 #
- Updated README
4.0.1 #
- Updated README
4.0.0 #
- Migrated to support Dart >= 2.12 NNBD
3.0.0 #
- Migrated to work with Dart >= 2.12 Non NNBD
2.1.1 #
AngelHttp.urinow returns an emptyUriif the server is not listening.
2.1.0 #
- This release was originally planned to be
2.0.5, but it adds several features, and has therefore been bumped to2.1.0. - Fix a new (did not appear before 2.6/2.7) type error causing compilation to fail. https://github.com/angel-dart/framework/issues/249
2.0.5-beta #
- Make
@Expose()inControlleroptional. https://github.com/angel-dart/angel/issues/107 - Add
allowHttp1toAngelHttp2constructors. https://github.com/angel-dart/angel/issues/108 - Add
deserializeBodyanddecodeBodytoRequestContext. https://github.com/angel-dart/angel/issues/109 - Add
HostnameRouter, which allows for routing based on hostname. https://github.com/angel-dart/angel/issues/110 - Default to using
ThrowingReflector, instead ofEmptyReflector. This will give a more descriptive error when trying to use controllers, etc. without reflection enabled. mountControllerreturns the mounted controller.
2.0.4+1 #
- Run
Controller.configureRoutesbefore mounting@Exposeroutes. - Make
Controller.configureServeralways return aFuture.
2.0.4 #
- Prepare for Dart SDK change to
Stream<List<int>>that are nowStream<Uint8List>. - Accept any content type if accept header is missing. See this PR.
2.0.3 #
- Patch up a bug caused by an upstream change to Dart's stream semantics. See more: https://github.com/angel-dart/angel/issues/106#issuecomment-499564485
2.0.2+1 #
- Fix a bug in the implementation of
Controller.applyRoutes.
2.0.2 #
- Make
ResponseContextexplicitly implementStreamConsumer(though technically it already did???) - Split
Controller.configureServerto createController.applyRoutes.
2.0.1 #
- Tracked down a bug in
Driver.runPipelinethat allowed fallback handlers to run, even after the response was closed. - Add
RequestContext.shutdownHooks. - Call
RequestContext.closeinDriver.sendResponse. - AngelConfigurer is now
FutureOr<void>, instead of justFutureOr. - Use a
Container.has<Stopwatch>check inDriver.sendResponse. - Remove unnecessary
newandconst.
2.0.0 #
- Angel 2! 👼 🚀
2.0.0-rc.10 #
- Fix an error that prevented
AngelHttp2.customfrom working properly. - Add
startSharedHttp2.
2.0.0-rc.9 #
- Fix some bugs in the
HookedServiceimplementation that skipped the outputs ofbeforeevents.
2.0.0-rc.8 #
- Fix
MapServiceflaw where clients could remove all records, even ifallowRemoveAllwerefalse.
2.0.0-rc.7 #
AnonymousServicecan overridereadData.Service.mapnow overridesreadData.HookedService.readDataforwards toinner.
2.0.0-rc.6 #
- Make
redirectanddownloadmethods asynchronous.
2.0.0-rc.5 #
- Make
serializerFutureOr<String> Function(Object). - Make
ResponseContext.serializereturnFuture<bool>.
2.0.0-rc.4 #
- Support resolution of asynchronous injections in controllers and
ioc. - Inject
RequestContextandResponseContextinto requests.
2.0.0-rc.3 #
MapService.modifywas not actually modifying items.
2.0.0-rc.2 #
- Fixes Pub analyzer lints (see
angel_route@3.0.6)
2.0.0-rc.1 #
- Fix logic error that allowed content to be written to streaming responses after
closewas closed.
2.0.0-rc.0 #
- Log a warning when no
reflectoris provided. - Add
AngelEnvironmentclass.- Add
Angel.environment. - Deprecated
app.isProductionin favor ofapp.environment.isProduction.
- Add
- Allow setting of
bodyAsObject,bodyAsMap, orbodyAsListexactly once. - Resolve named singletons in
resolveInjection. - Fix a bug where
Service.parseId<double>would attempt to parse anint. - Replace as Data cast in Service.dart with a method that throws a 400 on error.
2.0.0-alpha.24 #
- Add
AngelEnvclass tocore. - Deprecate
Angel.isProduction, in favor ofAngelEnv.
2.0.0-alpha.23 #
ResponseContext.rendersetscharsettoutf8incontentType.
2.0.0-alpha.22 #
- Update pipeline handling mechanism, and inject a
MiddlewarePipelineIterator.- This allows routes to know where in the resolution process they exist, at runtime.
2.0.0-alpha.21 #
- Update for
angel_route@3.0.4compatibility. - Add
readAsBytesandreadAsStringtoUploadedFile. - URI-decode path components in HTTP2.
2.0.0-alpha.20 #
- Inject the
MiddlewarePipelineinto requests.
2.0.0-alpha.19 #
parseBodychecks for null content type, and throws a400if none was given.- Add
ResponseContext.contentLength. - Update
streamFileto set content length, and also to work onHEADrequests.
2.0.0-alpha.18 #
- Upgrade
http2dependency. - Upgrade
uuiddependency. - Fixed a bug that prevented body parsing from ever completing with
http2. - Add
Providers.hashCode.
2.0.0-alpha.17 #
- Revert the migration to
lumberjackfor now. In the future, when it's more stable, there'll be a conversion, perhaps.
2.0.0-alpha.16 #
- Use
package:lumberjackfor logging.
2.0.0-alpha.15 #
- Remove dependency on
body_parser. RequestContextnow exposes aStream<List<int>> get bodygetter.- Calling
RequestContext.parseBody()parses its contents. - Added
bodyAsMap,bodyAsList,bodyAsObject, anduploadedFilestoRequestContext. - Removed
Angel.keepRawRequestBuffersand anything that had to do with buffering request bodies.
- Calling
2.0.0-alpha.14 #
- Patch
HttpResponseContext._openStreamto send content-length.
2.0.0-alpha.13 #
- Fixed a logic error in
HttpResponseContextthat prevented status codes from being sent.
2.0.0-alpha.12 #
- Remove
ResponseContext.sendFile. - Add
Angel.mimeTypeResolver. - Fix a bug where an unknown MIME type on
streamFilewould return a 500.
2.0.0-alpha.11 #
- Add
readManytoService. - Allow
ResponseContext.redirectto take aUri. - Add
Angel.mountController. - Add
Angel.findServiceOf. - Roll in HTTP/2. See
pkg:angel_framework/http2.dart.
2.0.0-alpha.10 #
- All calls to
Service.parseIdare now affixed with the<Id>argument. - Added
urigetter toAngelHttp. - The default for
parseQuerynow wraps query parameters inMap<String, dynamic>.from. This resolves a bug inpackage:angel_validate.
2.0.0-alpha.9 #
- Add
Service.map.
2.0.0-alpha.8 #
- No longer export HTTP-specific code from
angel_framework.dart. An import ofimport 'package:angel_framework/http.dart';will be necessary in most cases now.
2.0.0-alpha.7 #
- Force a tigher contract on services. They now must return
Dataon all methods except forindex, which returns aList<Data>.
2.0.0-alpha.6 #
- Allow passing a custom
ContainertohandleContainedand co.
2.0.0-alpha.5 #
MapServicemethods now explicitly returnMap<String, dynamic>.
2.0.0-alpha.4 #
- Renamed
waterfalltochain. - Renamed
Routable.servicetoRoutable.findService.- Also
Routable.findHookedService.
- Also
2.0.0-alpha.3 #
- Added
<Id, Data>type parameters toService. HookedServicenow follows suit, and takes a third parameter, pointing to the inner service.Routable.usenow uses the generic parameters added toService.- Added generic usage to
HookedServiceListener, etc. - All service methods take
Map<String, dynamic>asparamsnow.
2.0.0-alpha.2 #
- Added
ResponseContext.detach.
2.0.0-alpha.1 #
- Removed
Angel.injectEncoders. - Added
Providers.toJson. - Moved
Providers.graphqltoProviders.graphQL. Angel.optimizeForProductionno longer callspreInject, as it does not need to.- Rename
ResponseContext.enableBuffertoResponseContext.useBuffer.
2.0.0-alpha #
- Removed
random_stringdependency. - Moved reflection to
package:angel_container. - Upgraded
package:fileto5.0.0. ResponseContext.sendFilenow usespackage:file.- Abandon
ContentTypein favor ofMediaType. - Changed view engine to use
Map<String, dynamic>. - Remove dependency on
package:json_godby default. - Remove dependency on
package:dart2_constant. - Moved
lib/hooks.dartintopackage:angel_hooks. - Moved
TypedServiceintopackage:angel_typed_service. - Completely removed the
AngelBaseclass. - Removed all
@deprecatedsymbols. Service.toIdwas renamed toService.parseId; it also now uses its single type argument to determine how to parse a value. * In addition, this method was also madestatic.RequestContextandResponseContextare now generic, and take a single type argument pointing to the underlying request/response type, respectively.RequestContext.ioandResponseContext.ioare now permanently gone.HttpRequestContextImplandHttpResponseContextImplwere renamed toHttpRequestContextandHttpResponseContext.- Lazy-parsing request bodies is now the default;
Angel.lazyParseBodieswas replaced withAngel.eagerParseRequestBodies. Angel.storeOriginalBuffer->Angel.storeRawRequestBuffers.- The methods
lazyBody,lazyFiles, andlazyOriginalBufferonResponseContextwere all replaced withparseBody,parseUploadedFiles, andparseRawRequestBuffer, respectively. - Removed the synchronous equivalents of the above methods (
body,files, andoriginalBuffer), as well asquery. - Removed
Angel.injectionsandRequestContext.injections. - Removed
Angel.injectandRequestContext.inject. - Removed a dependency on
package:pool, which also meant removingAngelHttp.throttle. - Remove the
RequestMiddlewaretypedef; from now on, one should useResponseContext.endexclusively to close responses. waterfallwill now only acceptRequestHandler.Routable, and all of its subclasses, now extendRouter<RequestHandler>, and therefore only take routes in the form ofFutureOr myFunc(RequestContext, ResponseContext res).@Middlewarenow takes anIterableofRequestHandlers.@Expose.pathnow must be aString, not just anyPattern.@Expose.middlewarenow takesIterable<RequestHandler>, instead of justList.createDynamicHandlerwas renamed toioc, and is now used to run IoC-aware handlers in a type-safe manner.RequestContext.paramsis now aMap<String, dynamic>, rather than just aMap.- Removed
RequestContext.grab. - Removed
RequestContext.properties. - Removed the defunct
debugproperty where it still existed. Routable.usenow only accepts aService.- Removed
Angel.createZoneForRequest. - Removed
Angel.defaultZoneCreator. - Added all flags to the
Angelconstructor, ex.Angel.eagerParseBodies. - Fix a bug where synchronous errors in
handleRequestwould not be caught. AngelHttp.useZonenow defaults tofalse.ResponseContextnow starts in streaming mode by default; the response buffer is opt-in, as in many cases it is unnecessary and slows down response time.ResponseContext.streamingwas replaced byResponseContext.isBuffered.- Made
LockableBytesBuilderpublic. - Removed the now-obsolete
ResponseContext.willCloseItself. - Removed
ResponseContext.dispose. - Removed the now-obsolete
ResponseContext.end. - Removed the now-obsolete
ResponseContext.releaseCorrespondingRequest. preInjectnow takes aReflectoras its second argument.Angel.reflectordefaults toconst EmptyReflector(), disabling reflection out-of-the-box.