Add Custom Header Data to Android HTTP request

2019-05-20 08:14发布

I'm going to be making HTTP requests in an android application. There is some custom header data that I'd like to add. Specifically, I'm going to be using tickets to track authorized requests (I'm doing this so I can keep things RESTful). I'd like be able to basically add this to the HTTP header

ticketId : someTicketId

What is the simplest way to do this in android?

2条回答
够拽才男人
2楼-- · 2019-05-20 08:39

This function looks like it will do the trick.

查看更多
Evening l夕情丶
3楼-- · 2019-05-20 08:39

Brians is certainly correct for if you wanna use the apache stack. If you however want to use HttpURLConnection, this function will also do the trick.

查看更多
登录 后发表回答