Merge branch '1.0.x' into 1.1.x

This commit is contained in:
Andy Wilkinson
2016-08-10 17:22:58 +01:00
3 changed files with 17 additions and 16 deletions

View File

@@ -93,16 +93,16 @@ final class CliOperationRequest implements OperationRequest {
return false;
}
}
if (HttpHeaders.HOST.equalsIgnoreCase(header.getKey())) {
if (!header.getValue().isEmpty()) {
String value = header.getValue().get(0);
if (value.equals(this.delegate.getUri().getHost() + ":"
+ this.delegate.getUri().getPort())) {
return false;
}
if (HttpHeaders.HOST.equalsIgnoreCase(header.getKey())
&& (!header.getValue().isEmpty())) {
String value = header.getValue().get(0);
if (value.equals(this.delegate.getUri().getHost() + ":"
+ this.delegate.getUri().getPort())) {
return false;
}
}
return true;
}
@Override
@@ -173,10 +173,8 @@ final class CliOperationRequest implements OperationRequest {
@Override
public boolean allow(String name, List<String> value) {
if (value.isEmpty() || this.getImplicitHostHeader().equals(value.get(0))) {
return false;
}
return true;
return !(value.isEmpty()
|| this.getImplicitHostHeader().equals(value.get(0)));
}
private String getImplicitHostHeader() {

View File

@@ -24,7 +24,6 @@ import org.junit.Test;
import org.springframework.core.io.FileSystemResource;
import org.springframework.restdocs.templates.TemplateEngine;
import org.springframework.restdocs.templates.TemplateFormats;
import org.springframework.restdocs.templates.TemplateResourceResolver;
import org.springframework.restdocs.templates.mustache.MustacheTemplateEngine;
import org.springframework.restdocs.test.ExpectedSnippet;
@@ -44,7 +43,7 @@ import static org.springframework.restdocs.test.SnippetMatchers.tableWithHeader;
public class AsciidoctorRequestFieldsSnippetTests {
@Rule
public ExpectedSnippet snippet = new ExpectedSnippet(TemplateFormats.asciidoctor());
public ExpectedSnippet snippet = new ExpectedSnippet(asciidoctor());
@Test
public void requestFieldsWithListDescription() throws IOException {

View File

@@ -111,10 +111,14 @@ public final class SnippetMatchers {
}
protected void addLine(int index, String line) {
if (index < 0) {
index = index + this.lines.size();
this.lines.add(determineIndex(index), line);
}
private int determineIndex(int index) {
if (index >= 0) {
return index;
}
this.lines.add(index, line);
return index + this.lines.size();
}
@Override