- Fixed another bug related to CURVEBALL_TRUSTPROXY
- Actually check
CURVEBALL_TRUSTPROXY.
- Finally! Curveball v1. Only took 6 years.
- CommonJS support has been dropped. The previous version of this library supported both CommonJS and ESM. The effort of this no longer feels worth it. ESM is the future, so we're dropping CommonJS.
- Now requires Node 18.
- Export server version string
- ESM support.
- Dropped Node 14 support. Use Node 16 or later.
- Most of the internal plumbing has moved to
@curveball/kernel.@curveball/corestill contains all of the Node-specific code, but this allows curveball to run on Bun.
- Added support for
fetch(), which lets you make requests in an a Curveball application using the nativeRequestandResponseobjects.
- Now requires Node 14.
Application,Context,RequestandResponsenow have aoriginproperty. This defaults defaults tohttp://localhost. This can be overridden by settingApplication.origin, or setting aCURVEBALL_ORIGINenvironment variable.PUBLIC_URIalso works, but it's mainly a fallback for earlier examples and recommendations.RequestandContextnow have aabsoluteUrlproperty. This is calculated based on the request path and theorigin.- BC Break: Due to the new
originproperty, allRequestandResponseclasses now have an extra constructor argument. This means if you ever manually constructed any of these, there's a small change you'll need to make. Typescript should point all these problems! - If
CURVEBALL_TRUSTPROXYis set,request.ip()will trust proxies by default, and return the ip of the real client instead of the proxy.
Identical release as the previous alpha.
- The
Contextinterface has been removed, and theBaseContextclass is renamed toContext. This is a BC break, but should only be an issue if you used theContextinterface directly.BaseContextis still exported but simply aliased toContext. This alias will be removed from a future version. This change should make ite asier to use interface declaration merging to extend Context. - The
wsdependency has been updated to version 8. There are some breaking changes in this release. The most likely you'll hit is that incoming messages are now of typeBufferinstead ofstring. Check out the ws changelog for more details.
listen()now starts a WebSocket service on the same port by default.listenWs()is now deprecated, and will be removed in a future version.- JSON is now pretty-printed by default.
Happy birthday Mom!
- Update all dependencies and ensure compatibility with latest Typescript changes.
- Updated lint rules
- Make file update
- Updated dependencies
- Releasing on Github packages.
- Request.body is no longer optional, which will help with typing. It can still
be explicitly set to
null.
- This release is identical to the last
- BC Break:
Request.bodyis now typed asunknowninstead ofany. This forces users to either validate the body, or cast toany. - It's now possible to write directly to response streams by setting response.body to a callback.
- Curveball now required Node 12.
esModuleInteropflag is no longer required to use curveball.
- #155 -
listenandlistenWsnow both have a secondhostargument to bind to a specific interface. (@Nicholaiii) - #145 -
request.headersandresponse.headfunction to get a list of header values for a given header name. (@Nicholaiii)ersnow have agetMany()`
- Republish of 1.14.1, which was missing some changes.
- types ws package is now non-devDependency
- Native Websocket support. If enabled,
ctxwill now have awebSocketproperty.
- Removed
RequestandResponseinterfaces again. They actually made it more difficult to extend.
- Both
RequestandResponseare now typescript interfaces. This will allow plugins to extends them via interface declaration merging. - Everything is now compiled with the typescript 'strict' mode, which caused some internal refactoring.
- Added utilities to check
If-Match,If-None-Match,If-Modified-Since,If-Unmodified-Since. - Typescript target is now
es2019instead ofesnextto ensure that older Node.js versions are supported. - Added a workaround to make sure the package works around a bug in
@types/node@13.
- Set
Content-Typetotext/plainfor errors that fall without being caught by an exception handling middleware.
Contextis no longer a class, it's an interface. It's default implementation is nowBaseContext. This allows plugins to modify the interface and add new features.
- Added a
redirect()function toContextandResponseobjects, making it easier to set a status-code and location header in one step. - Support for more
Preferparameters:depth-noroot,safe,transclude.
- Fix a bug in HTTP/2 Push. Resources with query parameters in their path were not pushed correctly.
- The
is()function will now also match wildcards, such asimage/*.
rawBody()had an incorrect type. It should always return aBufferif the first argument is omitted.
- The server now sets a
application/hal+jsoncontent-type if nothing else was set. This fixes a regression from 0.9.0.
RequestandResponsetypes are now abstract classes instead of interfaces. This removes a bunch of duplication.Requestobjects now have aprefer()method for quickly reading out the values from the RFC7240Preferheader.
- Correctly set status for HTTP exceptions in sub-requests.
- Fixed a regression from 0.8.3.
- Correctly set status for HTTP exceptions in sub-requests.
- Subrequests should behave as regular requests and catch any exceptions.
- Updated all dependecies.
- Stricter typescript rules.
- Now exporting an
invokeMiddlewarefunction that can be used to chain and call mutltiple middlewares. - Application will now by default throw a
NotFoundexception if nothing handled a HTTP request.
- It's now possible to pass objects as Middlewares. If an object has a member
thats the
middlewareCallsymbol, it will call that instead. - The package now exports a
invokeMiddlewarefunction, which is a convenience method to call many middlewares. - #70: It's possible to set
Response.bodyto astream.Readableobject. - #91: Bugfix: The
accept()function ignored changes made my middlewares toAcceptheader.
- The
Contextobject now has anipmethod that can be used to get the ip address of the client that's connecting. - The
RequestandResponseobjects now have anis()method that can be used to easily check theContent-Typeheader of the object. For exampleRequest.is('json')will return true forapplication/hal+json. - The
Headersobject now has ahas()method.
- Request and Response object are now generic.
Response<T>implies the body property has typeT. ctx.statusis now writable.
- #74: Added
method,path,status,accepts,push,sendInformational, andqueryto Context object. These properties and methods all forward to the request or response object. - #78: By default the Application will return with a
404response, unless a middleware updates the status or a body was set. - Tests will now error when a node version under 8.11.2 is used. They broke before as well, but it's more explicit now about why.
Application.buildContextFromHttpis now public.
- #71: Fixed error messages when a HTTP/2 client disables or refuses a push late in the process.
- #72: Refactored node-specific code into its own directory.
- #57:
Response.typeis now settable.
- #4: Support for HTTP/2 push via the
Response.push()method. - #62: It's now possible to do internal sub-requests without going through the
HTTP stack, with
Application.subRequest(). - Added
MemoryRequestandMemoryResponse. - #56:
Response.bodymay now benull. - Renamed package to
@curveball/core.
- Added License, Code of Conduct.
- #52: Support for
Bufferand arbitrary objects inresponse.body. The latter will automatically get converted to JSON.
- #5: Support for informational status codes such as
100 Continueand103 Early Hintsfor both HTTP/1 and HTTP/2. - #28: HTTP2 support.
- #34:
Applicationis now the default export. - #47:
Application.callbacknow returns a callback instead of implementing it. This makes it a bit easier to deal withthisscope and is also consistent with Koa. - #48: Added a setter for
Response.status(). - Now exporting the
Middlewaretype.
- #19: Added
Request.rawBody()method. - #33: Added
Request.accept()method. - #35: Added
Request.typeandResponse.type. - #36: Added
Request.query. - #37:
Response.bodynow has typeany. - #38: Added
Context.state. - #39: Added
Application.callback.
- Set
scriptandtypescorrectly inpackage.json.
- Fixed npm package distribution. Was shipping the wrong files.
- Created
Request,Response,Application,Context,Headersclasses. - Basic framework works
- First published on npm.js to claim package name.