Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
47 changes: 47 additions & 0 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,3 +191,50 @@ jobs:
echo "- Total lines: ${{ steps.calc.outputs.total }}" >> $GITHUB_STEP_SUMMARY
echo "- Covered lines: ${{ steps.calc.outputs.covered }}" >> $GITHUB_STEP_SUMMARY
echo "- Coverage: ${{ steps.calc.outputs.coverage }}%" >> $GITHUB_STEP_SUMMARY

release:
name: Tag and Release
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Read version
id: version
run: |
VERSION=$(sed -n 's/.*EKNetworkVersionString = "\(.*\)".*/\1/p' Sources/EKNetwork/Version.swift)
if [ -z "$VERSION" ]; then
echo "❌ Failed to read version from Version.swift"
exit 1
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "tag=v$VERSION" >> "$GITHUB_OUTPUT"

- name: Create tag
id: tag
run: |
TAG="${{ steps.version.outputs.tag }}"
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "exists=true" >> "$GITHUB_OUTPUT"
echo "Tag $TAG already exists, skipping tag creation."
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "$TAG" -m "Release $TAG"
git push origin "$TAG"
echo "exists=false" >> "$GITHUB_OUTPUT"

- name: Create GitHub release
if: steps.tag.outputs.exists == 'false'
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.tag }}
generate_release_notes: true
4 changes: 4 additions & 0 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,10 @@ public enum HTTPMethod: String {
case put = "PUT"
case delete = "DELETE"
case patch = "PATCH"
case head = "HEAD"
case options = "OPTIONS"
case trace = "TRACE"
case connect = "CONNECT"
}
```

Expand Down
4 changes: 4 additions & 0 deletions API_RU.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ public enum HTTPMethod: String {
case put = "PUT"
case delete = "DELETE"
case patch = "PATCH"
case head = "HEAD"
case options = "OPTIONS"
case trace = "TRACE"
case connect = "CONNECT"
}
```

Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

_Nothing yet._
### Added
- Expanded supported HTTP methods to include `HEAD`, `OPTIONS`, `TRACE`, and `CONNECT` alongside the existing verbs.

### Changed
- CI now tags and creates a GitHub release automatically after successful tests on `main`.

## [1.4.2] - 2026-02-03

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ func testSignIn() async throws {

EKNetwork has comprehensive test coverage (115 tests, 99.42% code coverage) and provides protocols for easy testing:

- ✅ All HTTP methods (GET, POST, PUT, DELETE, PATCH)
- ✅ All HTTP methods (GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS, TRACE, CONNECT)
- ✅ Query parameters
- ✅ Various body types (JSON, Form URL Encoded, Multipart, Raw Data)
- ✅ Retry policy
Expand Down
3 changes: 1 addition & 2 deletions README_RU.md
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ func testSignIn() async throws {

EKNetwork имеет полное тестовое покрытие (21 тест) и предоставляет протоколы для легкого тестирования:

- ✅ Все HTTP методы (GET, POST, PUT, DELETE, PATCH)
- ✅ Все HTTP методы (GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS, TRACE, CONNECT)
- ✅ Query параметры
- ✅ Различные типы body (JSON, Form URL Encoded, Multipart, Raw Data)
- ✅ Retry policy
Expand Down Expand Up @@ -755,4 +755,3 @@ EKNetwork доступен под лицензией MIT. См. [LICENSE](LICENS
[⭐ Поставьте звезду, если проект полезен для вас!](#)

</div>

4 changes: 4 additions & 0 deletions Sources/EKNetwork/NetworkManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ public enum HTTPMethod: String {
case put = "PUT"
case delete = "DELETE"
case patch = "PATCH"
case head = "HEAD"
case options = "OPTIONS"
case trace = "TRACE"
case connect = "CONNECT"

}

Expand Down
5 changes: 4 additions & 1 deletion Tests/EKNetworkTests/AdditionalCoverageTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,10 @@ func testHTTPMethodRawValues() async throws {
#expect(HTTPMethod.put.rawValue == "PUT")
#expect(HTTPMethod.delete.rawValue == "DELETE")
#expect(HTTPMethod.patch.rawValue == "PATCH")
#expect(HTTPMethod.head.rawValue == "HEAD")
#expect(HTTPMethod.options.rawValue == "OPTIONS")
#expect(HTTPMethod.trace.rawValue == "TRACE")
#expect(HTTPMethod.connect.rawValue == "CONNECT")
}

// MARK: - Edge Cases Tests
Expand Down Expand Up @@ -986,4 +990,3 @@ func testRetryPolicyShouldRetryClosure() async throws {
#expect(retryBox.get() == true)
RetryProtocol.attempt?.deallocate()
}

7 changes: 5 additions & 2 deletions Tests/EKNetworkTests/ExtendedCoverageTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,11 @@ func testHTTPMethodRawValuesValidation() async throws {
(.post, "POST"),
(.put, "PUT"),
(.delete, "DELETE"),
(.patch, "PATCH")
(.patch, "PATCH"),
(.head, "HEAD"),
(.options, "OPTIONS"),
(.trace, "TRACE"),
(.connect, "CONNECT")
]

for (method, expected) in methods {
Expand Down Expand Up @@ -330,4 +334,3 @@ func testRequestWithAllOptionalParameters() async throws {
let response = try await manager.send(FullRequest(), accessToken: nil)
#expect(response.value == "full")
}

20 changes: 20 additions & 0 deletions Tests/EKNetworkTests/ExtendedTestSuite.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,26 @@ func testHTTPMethodPatch() {
#expect(HTTPMethod.patch.rawValue == "PATCH")
}

@Test("HTTPMethod head raw value")
func testHTTPMethodHead() {
#expect(HTTPMethod.head.rawValue == "HEAD")
}

@Test("HTTPMethod options raw value")
func testHTTPMethodOptions() {
#expect(HTTPMethod.options.rawValue == "OPTIONS")
}

@Test("HTTPMethod trace raw value")
func testHTTPMethodTrace() {
#expect(HTTPMethod.trace.rawValue == "TRACE")
}

@Test("HTTPMethod connect raw value")
func testHTTPMethodConnect() {
#expect(HTTPMethod.connect.rawValue == "CONNECT")
}

// MARK: - NetworkError

@Test("NetworkError invalidURL case")
Expand Down
4 changes: 4 additions & 0 deletions Tests/EKNetworkTests/NetworkManagerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,10 @@ func testHTTPMethods() async throws {
try await testMethod(.put, expectedMethod: "PUT")
try await testMethod(.delete, expectedMethod: "DELETE")
try await testMethod(.patch, expectedMethod: "PATCH")
try await testMethod(.head, expectedMethod: "HEAD")
try await testMethod(.options, expectedMethod: "OPTIONS")
try await testMethod(.trace, expectedMethod: "TRACE")
try await testMethod(.connect, expectedMethod: "CONNECT")
}

@MainActor
Expand Down
Loading