Handles.request constructor

const Handles.request(
  1. String? httpMethod,
  2. String? pattern, {
  3. String? pipeline,
  4. int? priority,
})

Constructor with an explicitly specified HTTP method.

The httpMethod is the name of the HTTP method, and pattern is the string representation of the pattern to match.

The optional pipeline name identifies the pipeline the rule is for. If no value is provided, it defaults to the ServerPipeline.defaultName.

The priority can be used to control the position of the rule in the pipeline. It takes precedence over the pattern. Specifying the priority is not recommended, because it can reorder the rules such that some rules will never be found. That would only make sense if an earlier rule deliberately didn't produce a response. Consider using multiple pipelines instead of the priority.

This constructor is usually used for non-standard HTTP methods. For standard HTTP methods, the Handles.get, Handles.post, Handles.put, Handles.patch, Handles.delete, Handles.head constructors can also be used.

Implementation

const Handles.request(this.httpMethod, this.pattern,
    {String? pipeline, int? priority})
    : pipeline = pipeline ?? ServerPipeline.defaultName,
      priority = priority ?? 0;