Polishing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
@@ -292,6 +292,11 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
||||
doAddHeaderValue(HttpHeaders.CONTENT_LENGTH, contentLength, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the length of the content body from the HTTP Content-Length header.
|
||||
* @return the value of the Content-Length header
|
||||
* @see #setContentLength(int)
|
||||
*/
|
||||
public int getContentLength() {
|
||||
return (int) this.contentLength;
|
||||
}
|
||||
@@ -742,7 +747,7 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
||||
|
||||
@Override
|
||||
public void setStatus(int status) {
|
||||
if (!this.isCommitted()) {
|
||||
if (!isCommitted()) {
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
@@ -752,6 +757,9 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
||||
return this.status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the error message used when calling {@link HttpServletResponse#sendError(int, String)}.
|
||||
*/
|
||||
@Nullable
|
||||
public String getErrorMessage() {
|
||||
return this.errorMessage;
|
||||
|
||||
Reference in New Issue
Block a user