Skip to content
This repository was archived by the owner on Apr 20, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,13 @@ import Submissions
try services.register(SubmissionsProvider())
```

It also include a middleware you have to register in your `MiddlewareConfig` :
It also includes a middleware you have to register in your `MiddlewareConfig` (needs to come after `ErrorMiddleware` if present, to avoid the `SubmissionValidationError`s from being transformed into Internal Server errors on the way back up the responder chain)

```swift
config.use(SubmissionsMiddleware.self)
```


This makes sure that fields and errors can be stored on the request using a `FieldCache` service.


Expand Down
2 changes: 1 addition & 1 deletion Sources/Submissions/SubmissionsMiddleware.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Vapor
/// up the responder chain.
public final class SubmissionsMiddleware: Middleware, ServiceType {

/// See `ServiceType`.
/// See `ServiceType`.
public static func makeService(for container: Container) throws -> SubmissionsMiddleware {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are tabs, please use spaces 🙂 (in the whole function)

return SubmissionsMiddleware()
}
Expand Down
1 change: 1 addition & 0 deletions Sources/Submissions/SubmissionsProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public final class SubmissionsProvider: Provider {

/// See `Provider`
public func register(_ services: inout Services) throws {
services.register(SubmissionsMiddleware.self)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more tabs that should be spaces 🙂

services.register { _ in FieldCache() }
}

Expand Down