Skip to content

Commit

Permalink
Update Dependencies, Update 204, 205 Responses (#36)
Browse files Browse the repository at this point in the history
### Goals ⚽
This PR updates dependencies and updates the 204 and 205 responses to
have properly empty bodies.
  • Loading branch information
jshier authored Jan 27, 2024
1 parent b2a633b commit 322d13b
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
name: macOS
runs-on: firebreak
env:
DEVELOPER_DIR: /Applications/Xcode_15.0.app/Contents/Developer
DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
name: Upload Release Artifact
runs-on: firebreak
env:
DEVELOPER_DIR: /Applications/Xcode_15.0.app/Contents/Developer
DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,19 @@ All notable changes to this project will be documented in this file.
- `0.x` Releases - [0.1.0](#010) | [0.2.0](#020) | [0.3.0](#030) | [0.4.0](#040) | [0.5.0](#050)
[0.6.0](#060) | [0.6.1](#061) | [0.7.0](#070) | [0.8.0](#080) | [0.8.1](#081)
[0.8.2](#082) | [0.8.3](#083) | [0.9.0](#090) | [0.9.1](#091) | [0.10.0](#0100) | [0.10.1](#0101)
[0.10.2](#0102) | [0.10.3](#01003)
[0.10.2](#0102) | [0.10.3](#01003) | [0.10.4](#01004)

---

## [0.10.4](https://github.com/Alamofire/Firewalk/releases/tag/0.10.4)

Released on 2023-01-27.

#### Updated

- Dependencies.
- Updated by [Jon Shier](https://github.com/jshier) in PR [#36](https://github.com/Alamofire/Firewalk/pull/36).

## [0.10.3](https://github.com/Alamofire/Firewalk/releases/tag/0.10.3)

Released on 2023-11-07.
Expand Down
69 changes: 39 additions & 30 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/swift-server/async-http-client.git",
"state" : {
"revision" : "16f7e62c08c6969899ce6cc277041e868364e5cf",
"version" : "1.19.0"
"revision" : "291438696abdd48d2a83b52465c176efbd94512b",
"version" : "1.20.1"
}
},
{
Expand All @@ -23,35 +23,35 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/vapor/console-kit.git",
"state" : {
"revision" : "f4ef965dadd999f7e4687053153c97b8b320819c",
"version" : "4.10.1"
"revision" : "a31f44ebfbd15a2cc0fda705279676773ac16355",
"version" : "4.14.1"
}
},
{
"identity" : "multipart-kit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/vapor/multipart-kit.git",
"state" : {
"revision" : "1adfd69df2da08f7931d4281b257475e32c96734",
"version" : "4.5.4"
"revision" : "12ee56f25bd3fc4c2d09c2aa16e69de61dc786e8",
"version" : "4.6.0"
}
},
{
"identity" : "routing-kit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/vapor/routing-kit.git",
"state" : {
"revision" : "17a7a3facce8285fd257aa7c72d5e480351e7698",
"version" : "4.8.2"
"revision" : "2a92a7eac411a82fb3a03731be5e76773ebe1b3e",
"version" : "4.9.0"
}
},
{
"identity" : "swift-algorithms",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-algorithms.git",
"state" : {
"revision" : "bcd4f369ac962bc3e5244c9df778739f8f5bdbf1",
"version" : "1.1.0"
"revision" : "f6919dfc309e7f1b56224378b11e28bab5bccc42",
"version" : "1.2.0"
}
},
{
Expand All @@ -68,35 +68,35 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-collections.git",
"state" : {
"revision" : "a902f1823a7ff3c9ab2fba0f992396b948eda307",
"version" : "1.0.5"
"revision" : "d029d9d39c87bed85b1c50adee7c41795261a192",
"version" : "1.0.6"
}
},
{
"identity" : "swift-crypto",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-crypto.git",
"state" : {
"revision" : "b51f1d6845b353a2121de1c6a670738ec33561a6",
"version" : "3.1.0"
"revision" : "cc76b894169a3c86b71bac10c78a4db6beb7a9ad",
"version" : "3.2.0"
}
},
{
"identity" : "swift-http-types",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-http-types",
"state" : {
"revision" : "99d066e29effa8845e4761dd3f2f831edfdf8925",
"version" : "1.0.0"
"revision" : "12358d55a3824bd5fed310b999ea8cf83a9a1a65",
"version" : "1.0.3"
}
},
{
"identity" : "swift-log",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-log.git",
"state" : {
"revision" : "532d8b529501fb73a2455b179e0bbb6d49b652ed",
"version" : "1.5.3"
"revision" : "e97a6fcb1ab07462881ac165fdbb37f067e205d5",
"version" : "1.5.4"
}
},
{
Expand All @@ -113,44 +113,44 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio.git",
"state" : {
"revision" : "853522d90871b4b63262843196685795b5008c46",
"version" : "2.61.1"
"revision" : "635b2589494c97e48c62514bc8b37ced762e0a62",
"version" : "2.63.0"
}
},
{
"identity" : "swift-nio-extras",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-extras.git",
"state" : {
"revision" : "798c962495593a23fdea0c0c63fd55571d8dff51",
"version" : "1.20.0"
"revision" : "363da63c1966405764f380c627409b2f9d9e710b",
"version" : "1.21.0"
}
},
{
"identity" : "swift-nio-http2",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-http2.git",
"state" : {
"revision" : "3bd9004b9d685ed6b629760fc84903e48efec806",
"version" : "1.29.0"
"revision" : "0904bf0feb5122b7e5c3f15db7df0eabe623dd87",
"version" : "1.30.0"
}
},
{
"identity" : "swift-nio-ssl",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-ssl.git",
"state" : {
"revision" : "320bd978cceb8e88c125dcbb774943a92f6286e9",
"version" : "2.25.0"
"revision" : "7c381eb6083542b124a6c18fae742f55001dc2b5",
"version" : "2.26.0"
}
},
{
"identity" : "swift-nio-transport-services",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-transport-services.git",
"state" : {
"revision" : "ebf8b9c365a6ce043bf6e6326a04b15589bd285e",
"version" : "1.20.0"
"revision" : "6cbe0ed2b394f21ab0d46b9f0c50c6be964968ce",
"version" : "1.20.1"
}
},
{
Expand All @@ -162,13 +162,22 @@
"version" : "1.0.2"
}
},
{
"identity" : "swift-system",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-system.git",
"state" : {
"revision" : "025bcb1165deab2e20d4eaba79967ce73013f496",
"version" : "1.2.1"
}
},
{
"identity" : "vapor",
"kind" : "remoteSourceControl",
"location" : "https://github.com/vapor/vapor.git",
"state" : {
"revision" : "d682e05fdb64c9f7da01af096a73cd11bb7ab755",
"version" : "4.86.2"
"revision" : "4942d74e8493fc918ed6144c835c8a0e6affd4f4",
"version" : "4.92.1"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ swiftSettings = []
let package = Package(name: "Firewalk",
platforms: [.macOS(.v10_15)],
products: [.executable(name: "firewalk", targets: ["firewalk"])],
dependencies: [.package(url: "https://github.com/vapor/vapor.git", from: "4.86.0")],
dependencies: [.package(url: "https://github.com/vapor/vapor.git", from: "4.92.0")],
targets: [.executableTarget(name: "firewalk",
dependencies: [.product(name: "Vapor", package: "vapor")],
path: "Sources",
Expand Down
18 changes: 11 additions & 7 deletions Sources/Methods.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,15 @@ func createMethodRoutes(for app: Application) throws {
case Int.min..<200:
return Response(status: .badRequest)
case 200..<300:
let reply = try Reply(to: request)
let encodedReply = try JSONEncoder().encodeAsByteBuffer(reply, allocator: app.allocator)
return Response(status: .init(statusCode: code), body: .init(buffer: encodedReply))
if code == 204 || code == 205 {
let response = Response(status: .init(statusCode: code))
response.headers.contentType = nil
return response
} else {
let reply = try Reply(to: request)
let encodedReply = try JSONEncoder().encodeAsByteBuffer(reply, allocator: app.allocator)
return Response(status: .init(statusCode: code), body: .init(buffer: encodedReply))
}
case 300..<400:
let response = Response(status: .init(statusCode: code))
let address = app.http.server.configuration.address
Expand All @@ -59,18 +65,16 @@ func createMethodRoutes(for app: Application) throws {
// NIO stops parsing HTTP when an upgrade is detected, so close the connection.
// Remove if NIO / Vapor fixes the issue.
if request.headers.contains(name: .upgrade) {
response.headers.connection = .close
response.headers.connection = .close
}

return response
default:
let response = Response(status: .badRequest)
// NIO stops parsing HTTP when an upgrade is detected, so close the connection.
// Remove if NIO / Vapor fixes the issue.
if request.headers.contains(name: .upgrade) {
response.headers.connection = .close
response.headers.connection = .close
}

return response
}
}
Expand Down

0 comments on commit 322d13b

Please sign in to comment.