Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add special casing of Data return type #30

Merged
merged 2 commits into from
Nov 7, 2023
Merged

Conversation

joshuawright11
Copy link
Owner

@joshuawright11 joshuawright11 commented Nov 7, 2023

This makes it so you can just return Data or Data? from your API function to easily access the raw response body. The first will throw an error if the response body is empty, the second will successfully return nil.

Issue #20.

@GET("/body")
func getBody() async throws -> Data

@GET("/optional_body")
func getOptionalBody() async throws -> Data?

@joshuawright11 joshuawright11 merged commit e7eec42 into main Nov 7, 2023
2 checks passed
@joshuawright11 joshuawright11 deleted the data-decoding branch November 7, 2023 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant