Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
s4cha authored Nov 16, 2023
1 parent e93e4ae commit d950f85
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ You can specify them using the `body` parameter.
##### URLEncoded
`Content-Type: application/x-www-form-urlencoded`

For url encoded boy, use `HttpBody.urlEncoded` type for the `body` parameter with a `[String: CustomStringConvertible]` dictionary.
For url encoded body, use `HttpBody.urlEncoded` type for the `body` parameter with a `[String: CustomStringConvertible]` dictionary.
```swift
try await client.post("/posts/1", body: .urlEncoded(["liked" : true ]))
```
Expand Down Expand Up @@ -298,7 +298,7 @@ struct CRUDApi: NetworkingService {

// Create
func create(article a: Article) async throws -> Article {
try await post("/articles", params: ["title" : a.title, "content" : a.content])
try await post("/articles", body: .json(a))
}

// Read
Expand All @@ -308,7 +308,7 @@ struct CRUDApi: NetworkingService {

// Update
func update(article a: Article) async throws -> Article {
try await put("/articles/\(a.id)", params: ["title" : a.title, "content" : a.content])
try await put("/articles/\(a.id)", body: .json(["title" : a.title]))
}

// Delete
Expand All @@ -331,7 +331,7 @@ struct CRUDApi: NetworkingService {

// Create
func create(article a: Article) -> AnyPublisher<Article, Error> {
post("/articles", params: ["title" : a.title, "content" : a.content])
post("/articles", body: .json(a))
}

// Read
Expand All @@ -341,7 +341,7 @@ struct CRUDApi: NetworkingService {

// Update
func update(article a: Article) -> AnyPublisher<Article, Error> {
put("/articles/\(a.id)", params: ["title" : a.title, "content" : a.content])
put("/articles/\(a.id)", body: .json(["title" : a.title]))
}

// Delete
Expand Down

0 comments on commit d950f85

Please sign in to comment.