kean / Get

Web API client built using async/await
MIT License
937 stars 74 forks source link

Fix withResponse() to respect the original method #62

Closed briancordanyoung closed 2 years ago

briancordanyoung commented 2 years ago

The withResponse<T>(_ type: T.Type) -> Request<T> method carries the comment:

Changes the response type keeping the rest of the request parameters.

Based on this I assume I ran in to a bug — because the request method may also be altered.

withResponse uses a private Initializer to create copy of the request with the updated return type. This initializer ignores the given method parameter and always sets the request to use the .get method.

This PR also includes a comment spelling fix.

kean commented 2 years ago

Thanks! Yes, that's clearly a defect.