Hardik Gondaliya
Hardik Gondaliya

Reputation: 326

How to set Headers in TRON api call?

I am newbie to the programming in iOS. I am building just simple app where I need to hit APIs for which I am using TRON.

My code Look like this

let tron = TRON(baseURL: "http://localhost:3000")
let request: APIRequest<HomeDataSource, JSONError> = tron.request("/api/v2/users/cards")

Its working perfectly fine but I want to set headers in above API call. can someone tell me how to set headers? I found the syntax in the documentation but couldn't figure it out myself.

Upvotes: 0

Views: 351

Answers (1)

userx
userx

Reputation: 1121

It is simple. Just do

request.headers = ["key": "value"]

From Documentation

Upvotes: 2

Related Questions