Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@samgilmore
Copy link
Owner

Description

This PR allows the user to easily set the body of a request as either a String, a Data object, or a Swift model of their choosing that conforms to Encodable.

@samgilmore samgilmore requested a review from erisean July 18, 2024 13:46
@samgilmore samgilmore self-assigned this Jul 18, 2024
case .jsonEncodable(let encodable):
let jsonData = try? JSONEncoder().encode(encodable)
urlRequest.httpBody = jsonData
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could consider adding some code in here as well to automatically add Content-Type header to the urlRequest depending on the body type if the user doesn't manually add it

@samgilmore samgilmore merged commit 7af57a5 into dev Jul 18, 2024
samgilmore added a commit that referenced this pull request Jul 25, 2024
* Add basic GET function

* Create network/request protocols and implementations (#2)

* Create basic protocols and implementations

Added network and request protocols as well as base implementations for each.

* Condense enum + abstract URLRequest

* Convert URLSession to stored variable

* Abstract configuration into enum

* feature/request-body-handling: Configurable request body (#3)

* Allow for data model in body

* Add default content-type header

* Add retry and timeout logic (#4)

* Add basic caching (#5)

* epic/cookie-management: Implement Cookie Management Operations and Request Configuration (#6)

* Implement Cookie Management

* Refactor into CookieManager

* Refactor Request + Private UD

* Add Request cookie method

* Implement batch requests (#7)
samgilmore added a commit that referenced this pull request Jul 25, 2024
* Add basic GET function

* Create network/request protocols and implementations (#2)

* Create basic protocols and implementations

Added network and request protocols as well as base implementations for each.

* Condense enum + abstract URLRequest

* Convert URLSession to stored variable

* Abstract configuration into enum

* feature/request-body-handling: Configurable request body (#3)

* Allow for data model in body

* Add default content-type header

* Add retry and timeout logic (#4)

* Add basic caching (#5)

* epic/cookie-management: Implement Cookie Management Operations and Request Configuration (#6)

* Implement Cookie Management

* Refactor into CookieManager

* Refactor Request + Private UD

* Add Request cookie method

* Implement batch requests (#7)

* Add docstrings + inline comments
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.

3 participants