Assert we return Location header with 201 CREATED
Add an assertion to the most popular way of turning the response object into the actual http response. As it stands all places we return `201 CREATED` we return the `Location` header. This will help to keep it that way, though it won't catch all uses. Followup to #19509
This commit is contained in:
parent
2e7336dc10
commit
e04f06258f
|
@ -37,8 +37,10 @@ public class RestStatusToXContentListener<Response extends StatusToXContent> ext
|
|||
* Build an instance that doesn't support responses with the status {@code 201 CREATED}.
|
||||
*/
|
||||
public RestStatusToXContentListener(RestChannel channel) {
|
||||
// TODO switch this to throwing an exception?
|
||||
this(channel, r -> null);
|
||||
this(channel, r -> {
|
||||
assert false: "Returned a 201 CREATED but not set up to support a Location header";
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue