Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Issue #53 #57

Merged
merged 5 commits into from
Mar 1, 2014
Merged

Fix Issue #53 #57

merged 5 commits into from
Mar 1, 2014

Conversation

allenxwang
Copy link

Fix Issue #53.

Created new JUnit test for POST with content.

@@ -96,8 +96,15 @@ public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise)
if (rxRequest.getHeaders().hasContent()) {
MultipleFutureListener allWritesListener = new MultipleFutureListener(promise);
allWritesListener.listen(ctx.write(rxRequest.getNettyRequest()));
if (rxRequest.hasRawContentSource()) {
RawContentSource<?> rawContentSource = rxRequest.getRawContentSource();
ContentSource<?> contentSource = null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

null initialization is redundant.

@NiteshKant
Copy link
Member

Apologies, I had to merge my pull request, so you would have to merge.

Allen Wang added 2 commits February 28, 2014 16:26
Merge branch 'master' of github.com:Netflix/RxNetty

Conflicts:
	src/main/java/io/reactivex/netty/protocol/http/client/HttpRequest.java
allenxwang pushed a commit that referenced this pull request Mar 1, 2014
@allenxwang allenxwang merged commit 7c86a10 into ReactiveX:master Mar 1, 2014
@@ -79,17 +106,46 @@
}

public HttpRequest<T> withContentSource(ContentSource<T> contentSource) {
this.contentSource = contentSource;
if (!contentSet.compareAndSet(false, true)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since, we are overwriting the content factory, why do we need this check?
The con is that it limits overriding the content later, in case it is to be reused.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My intention is that only one method from withContent*() can called. User should create new Request object to set a different content source/factory.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure but that constraint is not adding value to the code in terms of state
management, code clarity, etc. OTOH, it is making it difficult to reuse.
So, it seems to me that it is not required. Specially, since this is a
public API, I would recommend removing such a constraint.

On Friday, February 28, 2014, allenxwang [email protected] wrote:

In src/main/java/io/reactivex/netty/protocol/http/client/HttpRequest.java:

@@ -79,17 +106,46 @@
}

 public HttpRequest<T> withContentSource(ContentSource<T> contentSource) {
  •    this.contentSource = contentSource;
    
  •    if (!contentSet.compareAndSet(false, true)) {
    

My intention is that only one method from withContent*() can called. User
should create new Request object to set a different content source/factory.

Reply to this email directly or view it on GitHubhttps://github.com//pull/57/files#r10188652
.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point. I have removed such checking in pull request

#60

I will add more questions/comments on the issue itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants