Merge branch '5.1.x'

This commit is contained in:
Rossen Stoyanchev
2019-09-24 13:39:42 +01:00
6 changed files with 33 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -161,6 +161,15 @@ public class ExchangeResult {
return this.response.getStatusCode();
}
/**
* Return the HTTP status code (potentially non-standard and not resolvable
* through the {@link HttpStatus} enum) as an integer.
* @since 5.1.10
*/
public int getRawStatusCode() {
return this.response.getRawStatusCode();
}
/**
* Return the response headers received from the server.
*/

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -55,7 +55,7 @@ public class StatusAssertions {
* Assert the response status as an integer.
*/
public WebTestClient.ResponseSpec isEqualTo(int status) {
int actual = this.exchangeResult.getStatus().value();
int actual = this.exchangeResult.getRawStatusCode();
this.exchangeResult.assertWithDiagnostics(() -> AssertionErrors.assertEquals("Status", status, actual));
return this.responseSpec;
}