expectNotAllowedMethods function
- @experimental
- FutureOr<
Response> handler(- RequestContext
- required TestRequestContext contextBuilder(
- HttpMethod
- required List<
HttpMethod> allowedMethods,
Expect that all methods except allowedMethods
are not supported.
Implementation
@experimental
Future<void> expectNotAllowedMethods(
FutureOr<Response> Function(RequestContext) handler, {
required TestRequestContext Function(HttpMethod) contextBuilder,
required List<HttpMethod> allowedMethods,
}) async {
final methods = HttpMethod.values.where((m) => !allowedMethods.contains(m));
for (final method in methods) {
final context = contextBuilder(method);
final response = await handler(context.context);
expect(response, isMethodNotAllowed);
}
}