aharin / inproctester Goto Github PK
View Code? Open in Web Editor NEWHtmlUnit and WebDriver extensions to enable in-process testing of web applications
License: Apache License 2.0
HtmlUnit and WebDriver extensions to enable in-process testing of web applications
License: Apache License 2.0
When the URI is created with something of the form "http://somehost/path/to/some%20thing", UrlHelper will first unescape it and then construct a URI string from the unescaped path.
One way to prevent this is to fetch a string from a URI using new URI("http://somehost/path/to/some%20thing").toASCIIString().
Interestingly URLEncoder should be avoided for URIs used as locations since it doesn't handle the escaping correctly. it is actually intended for encoding form bodies to be sent using application/x-www-form-urlencoded. See http://stackoverflow.com/questions/4737841/urlencoder-not-able-to-translate-space-character for more details.
Also, what's the way in programaticaly?
driver = new InrocDriver(); ?
In the following, the explicit check for POST as HTTP method prevents content from the request being sent. The HTTP spec. doesn't explicitly disallow content for any method type so no check should be performed.
@Override
public InProcResponse getResponses(InProcRequest request) {
HttpTester httpTester = new HttpTester();
httpTester.setMethod(request.getHttpMethod());
httpTester.setURI(UrlHelper.getRequestPath(request.getUri()));
for (String headerName : request.getHeaderNames()) {
httpTester.addHeader(headerName, request.getHeader(headerName));
}
if ("POST".equals(request.getHttpMethod())) {
httpTester.setContent(request.getContent());
}
try {
String rawResponse = getResponses(httpTester.generate());
HttpTester testerResponse = new HttpTester();
testerResponse.parse(rawResponse);
return new JettyInProcResponse(testerResponse);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.