Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@
@Unique("http_client_request")
public class HttpClientRequest {

private static final Recorder recorder = Recorder.getInstance();
private static final Recorder recorder = Recorder.getInstance();

@HookClass(value = "java.net.HttpURLConnection")
public static void connect(Event event, HttpURLConnection httpURLConnection) {
//TODO: ReflectiveType can be used with HttpURLConnection
URL url = httpURLConnection.getURL();
event.setHttpClientRequest(httpURLConnection.getRequestMethod(), url.getHost(), url.getProtocol());
recorder.add(event);
}
// @HookClass(value = "java.net.HttpURLConnection")
public static void connect(Event event, HttpURLConnection httpURLConnection) {
//TODO: ReflectiveType can be used with HttpURLConnection
URL url = httpURLConnection.getURL();
event.setHttpClientRequest(httpURLConnection.getRequestMethod(), url.getHost(), url.getProtocol());
recorder.add(event);
}

@CallbackOn(MethodEvent.METHOD_RETURN)
@HookClass(value = "java.net.HttpURLConnection")
public static void connect(Event event, HttpURLConnection httpURLConnection, Object ret) throws IOException {
event.setHttpClientResponse(httpURLConnection.getResponseCode(), httpURLConnection.getContentType());
recorder.add(event);
}
// @CallbackOn(MethodEvent.METHOD_RETURN)
// @HookClass(value = "java.net.HttpURLConnection")
public static void connect(Event event, HttpURLConnection httpURLConnection, Object ret) throws IOException {
event.setHttpClientResponse(httpURLConnection.getResponseCode(), httpURLConnection.getContentType());
recorder.add(event);
}

}
3 changes: 2 additions & 1 deletion test/smoke.bats
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ load 'helper'
}

@test "expected number of http client events captured" {
skip

java_version=$(java -version 2>&1 | head -1 | cut -d'"' -f2 | sed 's/^1\.//'| cut -d'.' -f1 | cut -d'-' -f1)
if [ $java_version -gt "8" ]; then
Expand All @@ -138,4 +139,4 @@ load 'helper'
output=$(</tmp/appmap/*.appmap.json)
assert_json_eq '[.events[] | select(.http_client_request)] | length' 3
assert_json_eq '[.events[] | select(.http_client_response)] | length' 3
}
}