Skip to content

Commit

Permalink
Merge pull request #135 from allenxwang/master
Browse files Browse the repository at this point in the history
Added convenience method to add a single object with ContentTransformer to the HttpClientRequest
  • Loading branch information
allenxwang committed Jun 3, 2014
2 parents 0e84393 + c135ac2 commit 2e097df
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import io.netty.handler.codec.http.HttpRequest;
import io.netty.handler.codec.http.HttpVersion;
import io.reactivex.netty.serialization.ByteTransformer;
import io.reactivex.netty.serialization.ContentTransformer;

import java.nio.charset.Charset;

Expand Down Expand Up @@ -119,6 +120,10 @@ public HttpClientRequest<T> withRawContentSource(final RawContentSource<?> rawCo
setRawContentFactory(new SimpleContentSourceFactory(rawContentSource));
return this;
}

public HttpClientRequest<T> withRawContent(T content, ContentTransformer<T> transformer) {
return withRawContentSource(new SingletonRawSource<T>(content, transformer));
}

public HttpClientRequest<T> withContent(T content) {
setContentFactory(new SimpleContentSourceFactory<T, ContentSource<T>>(new ContentSource.SingletonSource<T>(
Expand Down

0 comments on commit 2e097df

Please sign in to comment.