Skip to content

Commit 54ad7ce

Browse files
authored
Update README.md
1 parent bd2e818 commit 54ad7ce

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# HttpUtility
22
HttpUtility is a light weight open source MIT license project which is helpful in making HTTP requests to the server. It uses URLSession to make requests to the API and returns the [Result enum](https://developer.apple.com/documentation/swift/result) containing the decoded object in case of success or a error incase of failure. Right now this utility only decodes JSON response returned by the server.
33

4-
[![Build Status](https://travis-ci.com/codecat15/HttpUtility.svg?branch=master)](https://travis-ci.com/codecat15/HttpUtility)
4+
[![Build Status](https://travis-ci.com/codecat15/HttpUtility.svg?branch=master)](https://travis-ci.com/codecat15/HttpUtility) [![Twitter](https://img.shields.io/badge/[email protected]?style=flat)](https://twitter.com/codecat15)
55

66
# Purpose of usage
77
Most of the time iOS application just perform simple HTTP operations which include sending request to the server and getting a response and displaying it to the user. If your iOS app does that then you may use this utility which does not do too much of heavy lifting and just pushes your request to the server and returns you a decoded object.
@@ -39,6 +39,7 @@ let requestUrl = URL(string: "http://demo0333988.mockable.io/Employees")
3939
```
4040

4141
## POST request example
42+
The httpUtility has an extra parameter "requestBody" where you should attach the data that you have to post to the server, in the given example the RegisterUserRequest is a struct inheriting from the [Encodable protocol](https://developer.apple.com/documentation/swift/encodable)
4243

4344
```swift
4445
let requestUrl = URL(string: "https://api-dev-scus-demo.azurewebsites.net/api/User/RegisterUser")
@@ -96,7 +97,7 @@ let utility = HttpUtility(token: basicToken)
9697
```
9798

9899
### Example: Bearer token
99-
```
100+
```swift
100101
let bearerToken = "bearer your_token"
101102
let utility = HttpUtility(token: bearerToken)
102103
```

0 commit comments

Comments
 (0)