This repository was archived by the owner on Oct 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
adds authenticated transport and non-standard api path connections #15
Merged
Merged
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d04afa0
api: add authenticated transport, and direct connection
033befd
api: expose headers via HttpApi, copy headers during request build
postables 9c7d495
api: remove WithAuthorization, DirectAPI client, instantiate header map
postables 2b48dd3
api: add wip api test
postables e98ef9f
Merge branch 'master' into client/auth
aea6890
api: call NewURLApiWithClient from NewApiWithClient
postables b8b55cb
api: cleanup header and NewURLApiWithClient test
postables ea50721
api: fix failing test
postables 3201304
remove unused transport.go file
postables File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package httpapi | ||
|
||
import "net/http" | ||
|
||
type transport struct { | ||
header, value string | ||
httptr http.RoundTripper | ||
} | ||
|
||
func newAuthenticatedTransport(tr http.RoundTripper, header, value string) *transport { | ||
return &transport{ | ||
header: header, | ||
value: value, | ||
httptr: tr, | ||
} | ||
} | ||
|
||
func (t *transport) RoundTrip(req *http.Request) (*http.Response, error) { | ||
req.Header.Set(t.header, t.value) | ||
return t.httptr.RoundTrip(req) | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.