Skip to content

Commit 322d13b

Browse files
authored
Update Dependencies, Update 204, 205 Responses (#36)
### Goals ⚽ This PR updates dependencies and updates the 204 and 205 responses to have properly empty bodies.
1 parent b2a633b commit 322d13b

File tree

6 files changed

+63
-41
lines changed

6 files changed

+63
-41
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
name: macOS
2626
runs-on: firebreak
2727
env:
28-
DEVELOPER_DIR: /Applications/Xcode_15.0.app/Contents/Developer
28+
DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer
2929
timeout-minutes: 10
3030
steps:
3131
- uses: actions/checkout@v4

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
name: Upload Release Artifact
1010
runs-on: firebreak
1111
env:
12-
DEVELOPER_DIR: /Applications/Xcode_15.0.app/Contents/Developer
12+
DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer
1313
steps:
1414
- name: Checkout
1515
uses: actions/checkout@v4

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,19 @@ All notable changes to this project will be documented in this file.
88
- `0.x` Releases - [0.1.0](#010) | [0.2.0](#020) | [0.3.0](#030) | [0.4.0](#040) | [0.5.0](#050)
99
[0.6.0](#060) | [0.6.1](#061) | [0.7.0](#070) | [0.8.0](#080) | [0.8.1](#081)
1010
[0.8.2](#082) | [0.8.3](#083) | [0.9.0](#090) | [0.9.1](#091) | [0.10.0](#0100) | [0.10.1](#0101)
11-
[0.10.2](#0102) | [0.10.3](#01003)
11+
[0.10.2](#0102) | [0.10.3](#01003) | [0.10.4](#01004)
1212

1313
---
1414

15+
## [0.10.4](https://github.com/Alamofire/Firewalk/releases/tag/0.10.4)
16+
17+
Released on 2023-01-27.
18+
19+
#### Updated
20+
21+
- Dependencies.
22+
- Updated by [Jon Shier](https://github.com/jshier) in PR [#36](https://github.com/Alamofire/Firewalk/pull/36).
23+
1524
## [0.10.3](https://github.com/Alamofire/Firewalk/releases/tag/0.10.3)
1625

1726
Released on 2023-11-07.

Package.resolved

Lines changed: 39 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ swiftSettings = []
3535
let package = Package(name: "Firewalk",
3636
platforms: [.macOS(.v10_15)],
3737
products: [.executable(name: "firewalk", targets: ["firewalk"])],
38-
dependencies: [.package(url: "https://github.com/vapor/vapor.git", from: "4.86.0")],
38+
dependencies: [.package(url: "https://github.com/vapor/vapor.git", from: "4.92.0")],
3939
targets: [.executableTarget(name: "firewalk",
4040
dependencies: [.product(name: "Vapor", package: "vapor")],
4141
path: "Sources",

Sources/Methods.swift

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,15 @@ func createMethodRoutes(for app: Application) throws {
4444
case Int.min..<200:
4545
return Response(status: .badRequest)
4646
case 200..<300:
47-
let reply = try Reply(to: request)
48-
let encodedReply = try JSONEncoder().encodeAsByteBuffer(reply, allocator: app.allocator)
49-
return Response(status: .init(statusCode: code), body: .init(buffer: encodedReply))
47+
if code == 204 || code == 205 {
48+
let response = Response(status: .init(statusCode: code))
49+
response.headers.contentType = nil
50+
return response
51+
} else {
52+
let reply = try Reply(to: request)
53+
let encodedReply = try JSONEncoder().encodeAsByteBuffer(reply, allocator: app.allocator)
54+
return Response(status: .init(statusCode: code), body: .init(buffer: encodedReply))
55+
}
5056
case 300..<400:
5157
let response = Response(status: .init(statusCode: code))
5258
let address = app.http.server.configuration.address
@@ -59,18 +65,16 @@ func createMethodRoutes(for app: Application) throws {
5965
// NIO stops parsing HTTP when an upgrade is detected, so close the connection.
6066
// Remove if NIO / Vapor fixes the issue.
6167
if request.headers.contains(name: .upgrade) {
62-
response.headers.connection = .close
68+
response.headers.connection = .close
6369
}
64-
6570
return response
6671
default:
6772
let response = Response(status: .badRequest)
6873
// NIO stops parsing HTTP when an upgrade is detected, so close the connection.
6974
// Remove if NIO / Vapor fixes the issue.
7075
if request.headers.contains(name: .upgrade) {
71-
response.headers.connection = .close
76+
response.headers.connection = .close
7277
}
73-
7478
return response
7579
}
7680
}

0 commit comments

Comments
 (0)