-
Notifications
You must be signed in to change notification settings - Fork 155
Open
Description
I'm trying to use Github's metadata matching to return code snippets/highlights in the response, as documented in https://developer.github.com/v3/search/#text-match-metadata. I know that I can add my own headers in HTTPoison, ie
header_list = Enum.to_list(headers)
[{"Accept", "application/vnd.github.v3.text-match+json"} | header_list]
So I can get back something like this:
...
"object_type": "FileContent",
"property": "content",
"fragment": "\",\n \"key_limit\": 2,\n \"owner\": {\n \"email",
"matches": [
{
"text": "key_limit",
"indices": [
16,
25
]
}
...
Is there a way to pass the header info during the client creation? I tried something like the following, but no luck:
Tentacat.Client.new(%{access_token: "#{token}", accept: "application/vnd.github.v3.text-match+json"}, "#{@uri}")
I also tried wrapping HTTPoison.base to pass the accept header, but I'm assuming that'll only work if I'm using all the HTTPoison base methods directly. Attempts to add text match as a header return results as a regular search api call. Any suggestions?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels