Skip to content

Commit

Permalink
Merge pull request #8 from Financial-Times/rollback-rhys-merge
Browse files Browse the repository at this point in the history
Revert "Automatically creating CODEOWNERS file [Skip CI]"
  • Loading branch information
Kalin Arsov committed Feb 8, 2021
2 parents 9f8a606 + 888de2d commit f306baa
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 147 deletions.
21 changes: 0 additions & 21 deletions LICENSE.md

This file was deleted.

22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,22 @@ Initialize logging with `WithLogger` to start logging the outgoing requests.

# Usage

## HTTP Client

For examples how to create new fthttp client refer to `examples_test.go`

## Transport
If you need to use the `transport` package separately;

Create a new `*http.Client` which sets a `User-Agent` of `PLATFORM-system-code/version` for all requests:

```
trans := transport.NewTransport().WithStandardUserAgent("PLATFORM", "system-code")
client := &http.Client{Transport: trans}
```

For examples how to use `transport.ExtensibleTransport` refer to the examples in `examples_test.go`
`NewTransport()` assumes you would like to use the default `http.DefaultRoundTripper`, and the `TransactionIDFromContext` extension.

# Notable Dependencies
Automatically set the `X-Request-Id` (see the [Transaction ID Utils Go](https://github.com/Financial-Times/transactionid-utils-go) library for more details):

* [go-logger v2](https://github.com/Financial-Times/go-logger)
```
ctx := tidutils.TransactionAwareContext(context.TODO(), "tid_1234")
req, err := http.NewRequestWithContext(ctx,"GET", uri, nil)
client.Do(req)
```
1 change: 0 additions & 1 deletion fthttp/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ func WithUserAgent(user string) Option {
}

// NewClient creates a http.Client object with the provided options
// If an option fails the produced error would be propagated to the caller of NewClient
func NewClient(options ...Option) (*http.Client, error) {
const defaultClientTimeout = 8 * time.Second
client := &http.Client{
Expand Down
47 changes: 0 additions & 47 deletions fthttp/examples_test.go

This file was deleted.

71 changes: 0 additions & 71 deletions transport/examples_test.go

This file was deleted.

0 comments on commit f306baa

Please sign in to comment.