How to modify headers
c2r1w opened this issue · 1 comments
c2r1w commented
How to modify headers
or implement bellow code
val request = Request(
url = "https://api.github.com/repos/mozilla-mobile/android-components/issues",
headers = MutableHeaders(
"User-Agent" to "AwesomeBrowser/1.0",
"Accept" to "application/json; q=0.5",
"Accept" to "application/vnd.github.v3+json"))
client.fetch(request).use { response ->
val server = response.headers.get('Server')
val result = response.body.string()
}
┆Issue is synchronized with this Jira Task
csadilek commented
You can assign a MutableHeaders
object to a val and modify it using the set
method, e.g.,
val headers = MutableHeaders()
headers.set("Accept-Encoding", "gzip, deflate")
headers.set("Connection", "keep-alive")
headers.set("Accept-Encoding", "gzip")