Week 14
News
We are back! A whole lot going on recently, most importantly Vapor 3 is tagged 🎉🎉🎉.
New Features
Add ContentTag
Additional overloads to req.content.encode(...)
were added. These allow for custom coders to be passed in as needed.
Add support for parsing header value params without =
Useful for parsing cookies
Add types for working with MIME
Added MediaType
, HeaderValue
, CaseInsensitiveString
and File
for content-type.
Add ‘NestedData’ protocol
Adds NestedData
: a data structure containing arbitrarily nested arrays and dictionaries
Add Thread.async(_:) method
Runs the supplied closure on a new thread. Calls Thread.detachNewThread(_:)
Adds Data Coders
A type capable of decoding Decodable
types from Data
.
Add a new future debug
Add debugging to future creation
Add a migration function name
Adds the ability to name migrations and to create migrations easily by just adding a closure
Adds a support for the deprecated flag
Adds support for the command’s flag with the form --option=value
NIO
Optimize for HTTP/1.1 and HTTP/1.0 responses
Motivation:
Its very likely that the response will be HTTP/1.1 or HTTP/1.0 so we can optimize for it by minimizing the buffer.write(…) calls. Beside this we should also change the pattern of *.write(into: inout ByteBuffer) to extension on ByteBuffer itself.
Modifications:
- Optimize for HTTP/1.0 and 1.1
- Use extensions on ByteBuffer
Result:
Faster and more clean code.
Add support for automatic HTTP error reporting
Motivation:
Currently the HTTP decoders can throw errors, but they will be ignored and lead to a simple EOF. That’s not ideal: in most cases we should make a best-effort attempt to send a 4XX error code before we shut the client down.
Modifications:
Provided a new ChannelHandler that generates 400 errors when the HTTP decoder fails. Added a flag to automatically add that handler to the channel pipeline. Added the handler to the HTTP sample server. Enabled integration test 12.
Result:
Easier error handling for HTTP servers.
Community Contributions
Ruby-on-Rails benchmark
Added guard for invalid cost
Related to vapor/crypto#57
Add the required imports for the sample user model
Fix a memory leak in QueueHandler
Follow API change in Crypto
Add extra HTTPHeaders to WebSocket client
Adds git hash capability to vapor cloud
Adds vapor cloud git-hash
Adding Host header to requests
Fixed FormURLEncoded Decoder Media Type Check
Adds TLS to HTTPClient
Fix Timestampable when the models are structs
Fix MySQL transaction support
Release pooled conn when catch for requestPooledConnection
Add url config to redis
Fix synchronization issue in QueueHandler
Fix infinite recursion in MySQLCharacterSet.description
Fixed issue with EventLoop assert
When sending asynchronously a ByteBuffer in a WebSocket, it fails since the current execution is not in the same EventLoop as the WebSocket handler.
Fix Cloud.yml
Fix the cloud.yml
file so it uses the latest commands required to run an app
Export Async to avoid an import when conforming to Fluent protocols
Default port in MySQLDatabaseConfig to 3306
Fix MySQL index syntax
Tagged releases
- HTTP 3.0.3
- Fluent 3.0.0 RC 2.4.1
- Core 3.1.6
- Crypto 3.1.1
- Routing 3.0.1
- DatabaseKit 1.0.0
- SQL 1.0.0
- Console 3.0.1
- Auth 2.0.0 RC 3.2
- URL-Encoded Form 1.0.2
- Vapor 3.0.0
Articles
Long article on starting with Vapor for Laravel developers
Sending multiple requests to different DBs using an array of Future
Brought to you by Ralph Küepper
Big list of tutorials (very good, huge shoutout to Mihaela)
Brought to you by @mihaelamj
Talks
Tim Condon on Getting Started with Server Side Swift with Vapor@CODEMOBILE
Kickstarting a project with Vapor 3 including CRUD operations
Brought to you by Vina Ranti @Engineers.SG
Kickstart a project with Vapor 3