Skip to main content

angel3_framework 10.0.1 copy "angel3_framework: ^10.0.1" to clipboard
angel3_framework: ^10.0.1 copied to clipboard

A high-powered HTTP server extensible framework with dependency injection, routing and much more.

Change Log #

10.0.1 #

Fixes in 10.0.1 #

  • Docs: Update supported templates on the README

10.0.0 #

Breaking changes in 10.0.0 #

  • Breaking: AngelHttp.addResponseHeader throws an ArgumentError, before adding any of the call's headers, for a header that cannot be sent, where dart:io threw an HttpException or a FormatException once it had added those before it, and removeResponseHeader throws one for a name that is not a header name
  • Breaking: AngelHttp.removeResponseHeader removes more of the default headers: each value of a list, every value equal to a given one, and, if none matches exactly, those that match ignoring case. It took a list as one value, which matched nothing, and removed only the first exact match
  • Breaking: MirrorsReflector moved to the new angel3_container_mirrors package
  • Breaking: chain stops at the first handler that does not return true, like a route's handlers
  • Breaking: Buffered responses use Content-Length instead of chunked encoding, unless res.chunked is true
  • Breaking: Service.parseId<bool> rejects ids other than true and false with a 400
  • Breaking: HTTP/2 sessions and their cookie are created only when req.session is first read

New in 10.0.0 #

  • AngelHttp2.addResponseHeader and AngelHttp2.removeResponseHeader set default headers of the responses, HTTP/2 ones and those of the HTTP/1 requests that allowHttp1 serves, by the rules of those of AngelHttp, and, unlike those, also before startServer. HTTP/2 responses get them as they send their headers, also an error response that is not finalized, but not the headers HTTP/2 forbids, such as connection, nor content-length, which only a response knows; a header dart:io keeps one value of, such as expires, keeps the last one added, and a default set-cookie is sent as given, before the response's own cookies. A response's own headers and cookies do not get the defaults. A header that cannot be sent, on HTTP/2 or by the rules dart:io has for headers such as expires, throws an ArgumentError, and adds none of the call's headers
  • AngelHttp.removeResponseHeader removes a header whatever its values when given null, and the HttpHeadersValues extension (addValues and removeValues) applies the same rules to any HttpHeaders
  • Works without dart:mirrors: @Expose, @Middleware and @Hooks work with a StaticReflector from angel3_container_generator
  • Graceful shutdown: Driver.close lets requests in progress finish, within the new closeTimeout, before the shutdown hooks run; Driver.drain does so without the hooks
  • ResponseContext.headersSent and abort: a handler that fails after the headers are sent aborts the response
  • injectionFor, injectionFromParameters and InjectableParameter, to build injections without a reflector
  • Controller.routesMethod, Driver.handleRawRequestSafely, Driver.supportsChunkedEncoding, Http2RequestContext.hasSession and UploadedFile(contentType:)

Fixes in 10.0.0 #

  • Default headers of AngelHttp: removeResponseHeader matches a DateTime in the HTTP-date form dart:io stores it in, and addResponseHeader and removeResponseHeader skip a null in a list, where it threw
  • Injection: Named parameters keep their defaults, and @Header, @Query, @CookieValue and @Session work for any type
  • Controllers: Controllers with getters, setters, static or private members can be mounted
  • Routing: app.group middleware runs, and typed parameters such as int:id do not match text
  • Hostnames: | alternatives and trailing dots work
  • Malformed requests: Bad headers and bodies are a 400 instead of a 500, a crash or a hang
  • Bodies: Concurrent parseBody calls share one parse. After a failed parse, bodyAsMap and the other body getters are empty, where they threw a StateError that made an error handler reading them answer a 500 instead of a 400
  • Content negotiation: accepts and Accept-Encoding honour q=0 and wildcards
  • Responses: res.done completes on close, and errors escaping a connection are logged instead of uncaught
  • Compression: Vary: Accept-Encoding is sent, and encoded, 204, 206 and 304 responses are not compressed
  • Helpers: Fixes to res.jsonp, res.redirectTo, writeCharCode and the error page's charset
  • Services: app.use services parse their ids, and an invalid id is a 400
  • HookedService: After-modify listeners fire, and canceled calls return their result
  • MapService: Returns copies of records, keeps ids and created-at on update, and handles concurrent writes
  • HTTP/2: Status and headers are sent for every response, request bodies use flow control, and malformed requests are a 400. A failure after a streamed response sent its headers resets the stream, where a second HEADERS frame broke the protocol, and AngelHttp2.drain returns the same future when called again
  • Server: Shutdown hooks run once on close, before services close, and subclasses of Angel can be constructed
  • Tests: The tests and examples no longer use MirrorsReflector
  • Docs: The README lists the available packages, tells how to install and use the package, and how to migrate from 9.x

9.2.0 #

Behaviour changes in 9.2.0 #

  • responseFinalizers also run on unbuffered responses, before the headers are sent; finalizers that read res.buffer should check res.isBuffered
  • HEAD requests are answered by the matching GET route, without a body, instead of a 404 or a fallback route
  • Controller methods named put… and head… map to PUT and HEAD, and the verb must be a whole word (posts() is GET /posts)

New in 9.2.0 #

  • Services, hooked services and @Middleware work without reflection, so apps can be built with dart compile exe
  • Controller(expose: ...) and ioc(..., injection: ...), to mount controllers and inject without reflection
  • Limits: request bodies up to 10 MB (larger ones are a 413), HTTP/2 sessions expire after 20 minutes idle, and the route cache holds 1024 entries
  • ResponseContext.attachmentDisposition() and Driver.closeServer()

Fixes in 9.2.0 #

  • Security: The error page and res.redirect() escape their content, and res.redirect() refuses javascript:, vbscript: and data: URLs (XSS). The HTTP/2 session cookie is Secure and HttpOnly, and res.download() no longer reveals the file's path
  • Stability: Malformed HTTP/2 headers, request-context errors and failed response closes are logged instead of crashing the server
  • HTTP/2: Header values are kept as sent, req.hostname comes from :authority, sessions are reused across requests, and pushes are not compressed
  • Compression: Streamed files and multi-write responses compress correctly, and q=0 encodings are skipped
  • Responses: Finalizers run once, invalid headers fail with a 500, res.addStream() writes into a buffered response, and res.download()/res.streamFile() return 404 for missing files
  • Requests: req.accepts() parses Accept properly, an empty JSON array body works, and a missing @CookieValue uses its default or is a 400
  • Routing: No match is a 404 instead of a 500, and HostnameRouter passes route parameters and builds each app once
  • Services: DELETE / means "remove all" (subject to allowRemoveAll), afterAllStream() emits after-events, and MapService issues are fixed
  • Server: startServer rethrows the original error and closes the server if a startup hook fails. handleRequest completes after an error response
  • Logging: Records are printed once, a custom logger keeps the app's listeners, and the "no reflector" message is info

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 lints to 6.0.0
  • Updated dependencies to the latest release

8.5.0 #

  • Require Dart >= 3.6
  • Updated lints to 5.0.0
  • Updated mime to 2.0.0
  • Fixed res.json() will cause 'Bad state: Cannot modify a closed response.' error.

8.4.0 #

  • Require Dart >= 3.3
  • Updated lints to 4.0.0

8.3.2 #

  • Updated README

8.3.1 #

  • Updated repository link

8.3.0 #

  • Updated lints to 3.0.0
  • Fixed linter warnings

8.2.0 #

  • Add addResponseHeader to AngelHttp to add headers to HTTP default response
  • Add removeResponseHeader to AngelHttp to remove headers from HTTP default response

8.1.1 #

  • Updated broken image on README

8.1.0 #

  • Updated uuid to 4.0.0

8.0.0 #

  • Require Dart >= 3.0
  • Updated http to 1.0.0

7.0.4 #

  • Updated Expose fields to non-nullable
  • Updated Controller to 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 BytesBuilder warnings

7.0.0 #

  • Require Dart >= 2.17

6.0.0 #

  • Require Dart >= 2.16
  • Updated container to non nullable
  • Updated angel to non nullable
  • Updated logger to 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 Date to response header
  • Updated Server: Angel3 response 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 Angel3 home page
  • Fixed pedantic warnings

4.1.0 #

  • Replaced http_server with belatuk_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.uri now returns an empty Uri if 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 to 2.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 #

2.0.4+1 #

  • Run Controller.configureRoutes before mounting @Expose routes.
  • Make Controller.configureServer always return a Future.

2.0.4 #

  • Prepare for Dart SDK change to Stream<List<int>> that are now Stream<Uint8List>.
  • Accept any content type if accept header is missing. See this PR.

2.0.3 #

2.0.2+1 #

  • Fix a bug in the implementation of Controller.applyRoutes.

2.0.2 #

  • Make ResponseContext explicitly implement StreamConsumer (though technically it already did???)
  • Split Controller.configureServer to create Controller.applyRoutes.

2.0.1 #

  • Tracked down a bug in Driver.runPipeline that allowed fallback handlers to run, even after the response was closed.
  • Add RequestContext.shutdownHooks.
  • Call RequestContext.close in Driver.sendResponse.
  • AngelConfigurer is now FutureOr<void>, instead of just FutureOr.
  • Use a Container.has<Stopwatch> check in Driver.sendResponse.
  • Remove unnecessary new and const.

2.0.0 #

  • Angel 2! 👼 🚀

2.0.0-rc.10 #

  • Fix an error that prevented AngelHttp2.custom from working properly.
  • Add startSharedHttp2.

2.0.0-rc.9 #

  • Fix some bugs in the HookedService implementation that skipped the outputs of before events.

2.0.0-rc.8 #

  • Fix MapService flaw where clients could remove all records, even if allowRemoveAll were false.

2.0.0-rc.7 #

  • AnonymousService can override readData.
  • Service.map now overrides readData.
  • HookedService.readData forwards to inner.

2.0.0-rc.6 #

  • Make redirect and download methods asynchronous.

2.0.0-rc.5 #

  • Make serializer FutureOr<String> Function(Object).
  • Make ResponseContext.serialize return Future<bool>.

2.0.0-rc.4 #

  • Support resolution of asynchronous injections in controllers and ioc.
  • Inject RequestContext and ResponseContext into requests.

2.0.0-rc.3 #

  • MapService.modify was 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 close was closed.

2.0.0-rc.0 #

  • Log a warning when no reflector is provided.
  • Add AngelEnvironment class.
    • Add Angel.environment.
    • Deprecated app.isProduction in favor of app.environment.isProduction.
  • Allow setting of bodyAsObject, bodyAsMap, or bodyAsList exactly once.
  • Resolve named singletons in resolveInjection.
  • Fix a bug where Service.parseId<double> would attempt to parse an int.
  • Replace as Data cast in Service.dart with a method that throws a 400 on error.

2.0.0-alpha.24 #

  • Add AngelEnv class to core.
  • Deprecate Angel.isProduction, in favor of AngelEnv.

2.0.0-alpha.23 #

  • ResponseContext.render sets charset to utf8 in contentType.

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.4 compatibility.
  • Add readAsBytes and readAsString to UploadedFile.
  • URI-decode path components in HTTP2.

2.0.0-alpha.20 #

  • Inject the MiddlewarePipeline into requests.

2.0.0-alpha.19 #

  • parseBody checks for null content type, and throws a 400 if none was given.
  • Add ResponseContext.contentLength.
  • Update streamFile to set content length, and also to work on HEAD requests.

2.0.0-alpha.18 #

  • Upgrade http2 dependency.
  • Upgrade uuid dependency.
  • Fixed a bug that prevented body parsing from ever completing with http2.
  • Add Providers.hashCode.

2.0.0-alpha.17 #

  • Revert the migration to lumberjack for now. In the future, when it's more stable, there'll be a conversion, perhaps.

2.0.0-alpha.16 #

  • Use package:lumberjack for logging.

2.0.0-alpha.15 #

  • Remove dependency on body_parser.
  • RequestContext now exposes a Stream<List<int>> get body getter.
    • Calling RequestContext.parseBody() parses its contents.
    • Added bodyAsMap, bodyAsList, bodyAsObject, and uploadedFiles to RequestContext.
    • Removed Angel.keepRawRequestBuffers and anything that had to do with buffering request bodies.

2.0.0-alpha.14 #

  • Patch HttpResponseContext._openStream to send content-length.

2.0.0-alpha.13 #

  • Fixed a logic error in HttpResponseContext that 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 streamFile would return a 500.

2.0.0-alpha.11 #

  • Add readMany to Service.
  • Allow ResponseContext.redirect to take a Uri.
  • 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.parseId are now affixed with the <Id> argument.
  • Added uri getter to AngelHttp.
  • The default for parseQuery now wraps query parameters in Map<String, dynamic>.from. This resolves a bug in package: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 of import '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 Data on all methods except for index, which returns a List<Data>.

2.0.0-alpha.6 #

  • Allow passing a custom Container to handleContained and co.

2.0.0-alpha.5 #

  • MapService methods now explicitly return Map<String, dynamic>.

2.0.0-alpha.4 #

  • Renamed waterfall to chain.
  • Renamed Routable.service to Routable.findService.
    • Also Routable.findHookedService.

2.0.0-alpha.3 #

  • Added <Id, Data> type parameters to Service.
  • HookedService now follows suit, and takes a third parameter, pointing to the inner service.
  • Routable.use now uses the generic parameters added to Service.
  • Added generic usage to HookedServiceListener, etc.
  • All service methods take Map<String, dynamic> as params now.

2.0.0-alpha.2 #

  • Added ResponseContext.detach.

2.0.0-alpha.1 #

  • Removed Angel.injectEncoders.
  • Added Providers.toJson.
  • Moved Providers.graphql to Providers.graphQL.
  • Angel.optimizeForProduction no longer calls preInject, as it does not need to.
  • Rename ResponseContext.enableBuffer to ResponseContext.useBuffer.

2.0.0-alpha #

  • Removed random_string dependency.
  • Moved reflection to package:angel_container.
  • Upgraded package:file to 5.0.0.
  • ResponseContext.sendFile now uses package:file.
  • Abandon ContentType in favor of MediaType.
  • Changed view engine to use Map<String, dynamic>.
  • Remove dependency on package:json_god by default.
  • Remove dependency on package:dart2_constant.
  • Moved lib/hooks.dart into package:angel_hooks.
  • Moved TypedService into package:angel_typed_service.
  • Completely removed the AngelBase class.
  • Removed all @deprecated symbols.
  • Service.toId was renamed to Service.parseId; it also now uses its single type argument to determine how to parse a value. * In addition, this method was also made static.
  • RequestContext and ResponseContext are now generic, and take a single type argument pointing to the underlying request/response type, respectively.
  • RequestContext.io and ResponseContext.io are now permanently gone.
  • HttpRequestContextImpl and HttpResponseContextImpl were renamed to HttpRequestContext and HttpResponseContext.
  • Lazy-parsing request bodies is now the default; Angel.lazyParseBodies was replaced with Angel.eagerParseRequestBodies.
  • Angel.storeOriginalBuffer -> Angel.storeRawRequestBuffers.
  • The methods lazyBody, lazyFiles, and lazyOriginalBuffer on ResponseContext were all replaced with parseBody, parseUploadedFiles, and parseRawRequestBuffer, respectively.
  • Removed the synchronous equivalents of the above methods (body, files, and originalBuffer), as well as query.
  • Removed Angel.injections and RequestContext.injections.
  • Removed Angel.inject and RequestContext.inject.
  • Removed a dependency on package:pool, which also meant removing AngelHttp.throttle.
  • Remove the RequestMiddleware typedef; from now on, one should use ResponseContext.end exclusively to close responses.
  • waterfall will now only accept RequestHandler.
  • Routable, and all of its subclasses, now extend Router<RequestHandler>, and therefore only take routes in the form of FutureOr myFunc(RequestContext, ResponseContext res).
  • @Middleware now takes an Iterable of RequestHandlers.
  • @Expose.path now must be a String, not just any Pattern.
  • @Expose.middleware now takes Iterable<RequestHandler>, instead of just List.
  • createDynamicHandler was renamed to ioc, and is now used to run IoC-aware handlers in a type-safe manner.
  • RequestContext.params is now a Map<String, dynamic>, rather than just a Map.
  • Removed RequestContext.grab.
  • Removed RequestContext.properties.
  • Removed the defunct debug property where it still existed.
  • Routable.use now only accepts a Service.
  • Removed Angel.createZoneForRequest.
  • Removed Angel.defaultZoneCreator.
  • Added all flags to the Angel constructor, ex. Angel.eagerParseBodies.
  • Fix a bug where synchronous errors in handleRequest would not be caught.
  • AngelHttp.useZone now defaults to false.
  • ResponseContext now 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.streaming was replaced by ResponseContext.isBuffered.
  • Made LockableBytesBuilder public.
  • Removed the now-obsolete ResponseContext.willCloseItself.
  • Removed ResponseContext.dispose.
  • Removed the now-obsolete ResponseContext.end.
  • Removed the now-obsolete ResponseContext.releaseCorrespondingRequest.
  • preInject now takes a Reflector as its second argument.
  • Angel.reflector defaults to const EmptyReflector(), disabling reflection out-of-the-box.