Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
MiSikora committed Feb 10, 2021
1 parent f0b44c6 commit 32b2bcf
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 10 deletions.
21 changes: 12 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# Change Log

This file follows [Keepachangelog](https://keepachangelog.com/) format.
This file follows [Keepachangelog](https://keepachangelog.com/) format.
Please add your entries according to this format.

## Unreleased

### Added
* Decoding of request and response bodies can now be customized. In order to do this a `BodyDecoder` interface needs to be implemented and installed in the `ChuckerInterceptor` via `ChuckerInterceptor.addBinaryDecoder(decoder)` method. Decoded bodies are then displayed in the Chucker UI.

### Fixed

* Fixed not setting request body type correctly [#538].
Expand Down Expand Up @@ -46,16 +49,16 @@ Please add your entries according to this format.

## Version 3.3.0 *(2020-09-30)*

This is a new minor release with multiple fixes and improvements.
After this release we are starting to work on a new major release 4.x with minSDK 21.
This is a new minor release with multiple fixes and improvements.
After this release we are starting to work on a new major release 4.x with minSDK 21.
Bumping minSDK to 21 is required to keep up with [newer versions of OkHttp](https://medium.com/square-corner-blog/okhttp-3-13-requires-android-5-818bb78d07ce).
Versions 3.x will be supported for 6 months (till March 2021) getting bugfixes and minor improvements.

### Summary of changes

* Added a new flag `alwaysReadResponseBody` into Chucker configuration to read the whole response body even if consumer fails to consume it.
* Added port numbers as part of the URL. Numbers appear if they are different from default 80 or 443.
* Chucker now shows partially read application responses properly. Earlier in 3.2.0 such responses didn't appear in the UI.
* Chucker now shows partially read application responses properly. Earlier in 3.2.0 such responses didn't appear in the UI.
* Transaction size is defined by actual payload size now, not by `Content-length` header.
* Added empty state UI for payloads, so no more guessing if there is some error or the payload is really empty.
* Added ability to export list of transactions.
Expand Down Expand Up @@ -198,7 +201,7 @@ This release was possible thanks to the contribution of:

### This version shouldn't be used as dependency due to [#203](https://github.com/ChuckerTeam/chucker/issues/203). Use 3.1.1 instead.

This is a new minor release of Chucker. Please note that this minor release contains multiple new features (see below) as well as multiple bugfixes.
This is a new minor release of Chucker. Please note that this minor release contains multiple new features (see below) as well as multiple bugfixes.

### Summary of Changes

Expand Down Expand Up @@ -235,11 +238,11 @@ This is a new minor release of Chucker. Please note that this minor release cont
This release was possible thanks to the contribution of:

@christopherniksch
@yoavst
@yoavst
@psh
@kmayoral
@vbuberen
@dcampogiani
@dcampogiani
@ullas-jain
@rakshit444
@olivierperez
Expand All @@ -249,8 +252,8 @@ This release was possible thanks to the contribution of:
@koral--
@redwarp
@uOOOO
@sprohaszka
@PaulWoitaschek
@sprohaszka
@PaulWoitaschek


## Version 3.0.1 *(2019-08-16)*
Expand Down
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ _A fork of [Chuck](https://github.com/jgilfelt/chuck)_
* [Multi-Window](#multi-window-)
* [Configure](#configure-)
* [Redact-Header️](#redact-header-️)
* [Decode-Body](#decode-body-)
* [Migrating](#migrating-)
* [Snapshots](#snapshots-)
* [FAQ](#faq-)
Expand Down Expand Up @@ -65,7 +66,7 @@ android {

**That's it!** 🎉 Chucker will now record all HTTP interactions made by your OkHttp client.

Historically, Chucker was distributed through JitPack.
Historically, Chucker was distributed through JitPack.
You can find older version of Chucker here: [![JitPack](https://jitpack.io/v/ChuckerTeam/chucker.svg)](https://jitpack.io/#ChuckerTeam/chucker).

## Features 🧰
Expand All @@ -79,6 +80,7 @@ Don't forget to check the [changelog](CHANGELOG.md) to have a look at all the ch
* **Empty release artifact** 🧼 (no traces of Chucker in your final APK).
* Support for body text search with **highlighting** 🕵️‍♂️
* Support for showing **images** in HTTP Responses 🖼
* Support for custom decoding of HTTP bodies

### Multi-Window 🚪

Expand Down Expand Up @@ -112,6 +114,9 @@ val chuckerInterceptor = ChuckerInterceptor.Builder(context)
// This is useful in case of parsing errors or when the response body
// is closed before being read like in Retrofit with Void and Unit types.
.alwaysReadResponseBody(true)
// Use decoder when processing request and response bodies. When multiple decoders are installed they
// are applied in an order they were added.
.addBodyDecoder(decoder)
.build()

// Don't forget to plug the ChuckerInterceptor inside the OkHttpClient
Expand All @@ -128,10 +133,28 @@ It is intended for **use during development**, and not in release builds or othe

You can redact headers that contain sensitive information by calling `redactHeader(String)` on the `ChuckerInterceptor`.


```kotlin
interceptor.redactHeader("Auth-Token", "User-Session");
```

### Decode-Body 📖

Chucker by default handles only plain text bodies. If you use a binary format like, for example, Protobuf or Thrift it won't be automatically handled by Chucker. You can, however, install a custom decoder that is capable to read data from different encodings.

```kotlin
object ProtoDecoder : BinaryDecoder {
fun decodeRequest(request: Request, body: ByteString): String? = if (request.isExpectedProtoRequest) {
decodeProtoBody(body)
} else null

fun decodeResponse(request: Response, body: ByteString): String? = if (request.isExpectedProtoResponse) {
decodeProtoBody(body)
} else null
}
interceptorBuilder.addBodyDecoder(ProtoDecoder).build()
```

## Migrating 🚗

If you're migrating **from [Chuck](https://github.com/jgilfelt/chuck) to Chucker**, please refer to this [migration guide](/docs/migrating-from-chuck.md).
Expand Down

0 comments on commit 32b2bcf

Please sign in to comment.