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

added more parsers #3

Merged
merged 1 commit into from
May 15, 2019
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 @@ -8,6 +8,7 @@
import org.openqa.selenium.devtools.network.types.SignedExchangeInfo;
import org.openqa.selenium.json.JsonInput;

import java.util.ArrayList;
import java.util.List;

/**
Expand Down Expand Up @@ -51,10 +52,26 @@ private static SignedExchangeReceived fromJson(JsonInput input) {
case "outerResponse":
outerResponse = Response.parseResponse(input);
break;
case "header":
header = SignedExchangeHeader.parseResponse(input);
break;
case "securityDetails":
securityDetails = SecurityDetails.parseResponse(input);
break;
case "errors":
input.beginArray();
errors = new ArrayList<>();
while (input.hasNext()) {
errors.add(SignedExchangeError.parseResponse(input));
}
input.endArray();
break;
default:
input.skipValue();
break;

}
}
//TODO: @GED add parse for header, securityDetails, errors
info = new SignedExchangeInfo(outerResponse, header, securityDetails, errors);
break;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.openqa.selenium.devtools.network.types;

/**
* Created by aohana
* Whether the request complied with Certificate Transparency policy
*/
public enum CertificateTransparencyCompliance {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ public void setSecurityDetails(SecurityDetails securityDetails) {
}

public static Response parseResponse(JsonInput input) {
Response redirectResponse;
Response response;
input.beginObject();

String responseUrl = null;
Expand Down Expand Up @@ -368,21 +368,30 @@ public static Response parseResponse(JsonInput input) {
case "encodedDataLength":
encodedDataLength = input.nextNumber();
break;
case "protocol":
protocol = input.nextString();
break;
case "securityState":
securityState = SecurityState.valueOf(input.nextString());
break;
case "securityDetails":
securityDetails = SecurityDetails.parseSecurityDetails(input);
break;
default:
input.skipValue();
break;
}
}
//TODO: @GED add parse for timing, protocol, securityState, securityDetails
redirectResponse =

response =
new Response(responseUrl, Integer.valueOf(String.valueOf(status)), statusText,
responseHeaders, headersText, mimeType, requestHeaders,
requestHeadersText, connectionReused,
Double.valueOf(String.valueOf(connectionId)), remoteIPAddress,
Integer.valueOf(String.valueOf(remotePort)), fromDiskCache,
fromServiceWorker, Double.valueOf(String.valueOf(encodedDataLength)), timing,
protocol, securityState, securityDetails);
return redirectResponse;
return response;
}

}
Loading