Skip to content

Commit

Permalink
Added info about Header modifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmike authored Feb 4, 2017
1 parent 21c20c1 commit 6000158
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ OkHttpClient okHttp = new OkHttpClient.Builder()

To get know more about Interceptor in OkHttp take a look here: https://github.com/square/okhttp/wiki/Interceptors

## Header modifiers
Ok2Curl allows you to modify any header before creating curl command. All you have to do is create your own modifier that implements [HeaderModifier](https://github.com/mrmike/Ok2Curl/blob/master/ok2curl/src/main/java/com/moczul/ok2curl/modifier/HeaderModifier.java)
and add this modifier to CurlInterceptor. See [sample](https://github.com/mrmike/Ok2Curl/blob/master/sample/src/main/java/com/moczul/sample/RequestService.java) for reference.
```
final BasicAuthorizationHeaderModifier modifier = new BasicAuthorizationHeaderModifier(new Base64Decoder());
final List<HeaderModifier> modifiers = Collections.<HeaderModifier>singletonList(modifier);
final CurlInterceptor curlInterceptor = new CurlInterceptor(new AndroidLogger(), modifiers);
```

## License

Copyright 2015 Michał Moczulski
Expand Down

0 comments on commit 6000158

Please sign in to comment.