Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Just a simple upgrade to littleproxy-1.0beta4 #127

Merged
merged 1 commit into from

2 participants

@dkowis

Just keeping the API compatible at the moemnt. It looks like the betamax
filters modify the object inline, so returning the object after the
modifications should make it work.

@dkowis dkowis Just a simple upgrade to littleproxy-1.0beta4
Just keeping the API compatible at the moemnt. It looks like the betamax
filters modify the object inline, so returning the object after the
modifications should make it work.
11f2dd8
@robfletcher robfletcher merged commit 98b95da into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 27, 2014
  1. @dkowis

    Just a simple upgrade to littleproxy-1.0beta4

    dkowis authored
    Just keeping the API compatible at the moemnt. It looks like the betamax
    filters modify the object inline, so returning the object after the
    modifications should make it work.
This page is out of date. Refresh to see the latest.
View
8 betamax-proxy/src/main/java/co/freeside/betamax/proxy/BetamaxFilters.java
@@ -86,7 +86,7 @@ public HttpResponse requestPost(HttpObject httpObject) {
}
@Override
- public void responsePre(HttpObject httpObject) {
+ public HttpObject responsePre(HttpObject httpObject) {
if (httpObject instanceof HttpResponse) {
upstreamResponse = NettyResponseAdapter.wrap(httpObject);
}
@@ -108,14 +108,18 @@ public void responsePre(HttpObject httpObject) {
throw new NonWritableTapeException();
}
}
+
+ return httpObject;
}
@Override
- public void responsePost(HttpObject httpObject) {
+ public HttpObject responsePost(HttpObject httpObject) {
if (httpObject instanceof HttpResponse) {
setBetamaxHeader((HttpResponse) httpObject, "REC");
setViaHeader((HttpMessage) httpObject);
}
+
+ return httpObject;
}
private Optional<? extends FullHttpResponse> onRequestIntercepted() throws IOException {
View
12 betamax-proxy/src/main/java/co/freeside/betamax/proxy/netty/PredicatedHttpFilters.java
@@ -59,16 +59,20 @@ public HttpResponse requestPost(HttpObject httpObject) {
}
@Override
- public void responsePre(HttpObject httpObject) {
+ public HttpObject responsePre(HttpObject httpObject) {
if (predicate.apply(originalRequest)) {
- delegate.responsePre(httpObject);
+ return delegate.responsePre(httpObject);
+ } else {
+ return httpObject;
}
}
@Override
- public void responsePost(HttpObject httpObject) {
+ public HttpObject responsePost(HttpObject httpObject) {
if (predicate.apply(originalRequest)) {
- delegate.responsePost(httpObject);
+ return delegate.responsePost(httpObject);
+ } else {
+ return httpObject;
}
}
}
View
2  betamax.gradle
@@ -39,7 +39,7 @@ allprojects {
}),
httpClient: dependencies.create("org.apache.httpcomponents:httpclient:4.3.1"),
junit: dependencies.create("junit:junit:4.10"),
- littleProxy: dependencies.create("org.littleshoot:littleproxy:1.0.0-beta3"),
+ littleProxy: dependencies.create("org.littleshoot:littleproxy:1.0.0-beta4"),
netty: dependencies.create("io.netty:netty-all:4.0.11.Final"),
snakeYaml: dependencies.create("org.yaml:snakeyaml:1.13"),
spock: dependencies.create("org.spockframework:spock-core:0.7-groovy-2.0", {
Something went wrong with that request. Please try again.