Skip to content

Commit

Permalink
fixing tests, response with 100 continue when required by the client …
Browse files Browse the repository at this point in the history
…(nuget.exe v 3.5 in my case)
  • Loading branch information
Evgeniy.Koshkin committed Jul 22, 2016
1 parent 1ab69cb commit e3c7601
Showing 1 changed file with 33 additions and 6 deletions.
Expand Up @@ -51,6 +51,7 @@
* Date: 22.07.11 1:25
*/
public class PackagesPublishIntegrationTest extends IntegrationTestBase {
private static final String STATUS_LINE_100 = "HTTP/1.1 100 Continue";
protected NuGetPublishParameters myPublishParameters;

@BeforeMethod
Expand Down Expand Up @@ -106,12 +107,25 @@ protected void postProcessSocketData(String httpHeader, @NotNull InputStream is)

@Override
protected Response getResponse(String request) {
System.out.println(">>" + request);
System.out.println(">> " + request);
String responseStatusLine;
String responseContent;
if (request.startsWith("PUT")) {
hasPUT.set(true);
return createStringResponse(STATUS_LINE_201, Collections.<String>emptyList(), "Created");
if (request.contains("Expect: 100-continue")){
responseStatusLine = STATUS_LINE_100;
responseContent = "Continue";
}
else{
responseStatusLine = STATUS_LINE_201;
responseContent = "Created";
}
} else {
responseStatusLine = STATUS_LINE_200;
responseContent = "Ok";
}
return createStringResponse(STATUS_LINE_200,Collections.<String>emptyList(), "Ok");
System.out.println(String.format("<< %s %s", responseStatusLine, responseContent));
return createStringResponse(responseStatusLine, Collections.<String>emptyList(), responseContent);
}
};

Expand Down Expand Up @@ -153,12 +167,25 @@ protected boolean authorizeUser(@NotNull String loginPassword) {

@Override
protected Response getAuthorizedResponse(String request) throws IOException {
System.out.println(">>" + request);
System.out.println(">> " + request);
String responseStatusLine;
String responseContent;
if (request.startsWith("PUT")) {
hasPUT.set(true);
return createStringResponse(STATUS_LINE_201, Collections.<String>emptyList(), "Created");
if (request.contains("Expect: 100-continue")){
responseStatusLine = STATUS_LINE_100;
responseContent = "Continue";
}
else{
responseStatusLine = STATUS_LINE_201;
responseContent = "Created";
}
} else {
responseStatusLine = STATUS_LINE_200;
responseContent = "Ok";
}
return createStringResponse(STATUS_LINE_200,Collections.<String>emptyList(), "Ok");
System.out.println(String.format("<< %s %s", responseStatusLine, responseContent));
return createStringResponse(responseStatusLine, Collections.<String>emptyList(), responseContent);
}
};

Expand Down

0 comments on commit e3c7601

Please sign in to comment.