You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 7, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Nov 7, 2026. It is now read-only.
Maven, MitmProxy version 9: AttributeError: module 'mitmproxy.http' has no attribute 'HTTPResponse' #20
I recently started a Maven project using mitmproxy-java. Anytime I try to change the status code of an intercepted call, I get this error: AttributeError: module 'mitmproxy.http' has no attribute 'HTTPResponse'
`List messages = new ArrayList<>();
MitmproxyJava proxy = new MitmproxyJava("/Library/Frameworks/Python.framework/Versions/3.10/bin/mitmdump", (InterceptedMessage m) -> {
messages.add(m);
m.getResponse().setBody("Hi from Test".getBytes(StandardCharsets.UTF_8));
m.getResponse().getHeaders().add(new String[]{"myTestResponseHeader", "myTestResponseHeaderValue"});
m.getResponse().setStatusCode(500);
return m;
});
proxy.start();
Unirest.setProxy(new HttpHost("localhost", 8080));
HttpResponse<String> response = Unirest.get("http://appium.io").asString();
driver.get("http://appium.io");
System.out.println("RESPONSE");
System.out.println(messages.get(0));
TimeUnit.SECONDS.sleep(15);
proxy.stop();
assertThat(response.getBody()).isEqualTo("Hi from Test");
final InterceptedMessage firstMessage = messages.get(0);
assertThat(firstMessage.getRequest().getUrl()).startsWith("http://appium.io/");
assertThat(firstMessage.getRequest().getHeaders()).containsOnlyOnce(new String[]{"myTestHeader", "myTestValue"});
assertThat(firstMessage.getResponse().getHeaders()).containsOnlyOnce(new String[]{"myTestResponseHeader", "myTestResponseHeaderValue"});
System.out.println(firstMessage.getResponse().getStatusCode());
assertThat(firstMessage.getResponse().getStatusCode()).isEqualTo(500);`
I see that the newest version is 2.0.2 and I'm hoping it has the fix. But currently only 2.0.1 is available on Maven to insert into the POM file.
I did find a work around until they make a push. I created my on jar file from this repo and added it to my pom. Then I had to add more libraries but it now works. I no longer get the error message.
Activity
t-o-n-y-p commentedon May 5, 2023
Hello, same thing here. Could you devs please push the fix to maven central? Thanks.
shlmvgett commentedon May 6, 2023
Hi
The same problem is actual for us, could u update version on mvn repo?
bp32891 commentedon May 8, 2023
I did find a work around until they make a push. I created my on jar file from this repo and added it to my pom. Then I had to add more libraries but it now works. I no longer get the error message.
Jonahss commentedon May 8, 2023
Sorry about the delay. I'll see about updating in Maven.
valeo28 commentedon May 11, 2023
Hi! Please uploade it to Maven Central.
Jonahss commentedon May 12, 2023
Hi, I've been busy on my Wyldcard project, but thanks for poking me to update this. I'll see if I can do it on Monday.
jlipps commentedon May 12, 2023
that's such a cool project dude!
re-jim commentedon May 16, 2023
@Jonahss poke again, please update this.
Jonahss commentedon May 18, 2023
I'm finally working on it :D
My credentials to Maven Central are no longer valid. I'm talking to the active Appium team to get access.
Thanks for pinging me, sorry for the delay.
t-o-n-y-p commentedon Sep 21, 2023
Hello, how is the progress on this?
Jonahss commentedon Sep 21, 2023
Hello. I think I have everything I need now. Will work on this today and tomorrow. Thanks again for pinging.
Jonahss commentedon Sep 21, 2023
@t-o-n-y-p @re-jim v2.0.2 published to central repository.
Can you verify the code works as intended?
t-o-n-y-p commentedon Sep 27, 2023
Unfortunately, I no longer have access to the environment to check it, thanks for publishing though :)
Jonahss commentedon Sep 27, 2023
halilcifteci commentedon Jan 16, 2024
Hi, after upgrading my project, there was no problem. thanks @Jonahss
Jonahss commentedon Jan 18, 2024
Yay! Okay, can close with confidence :D