OrchardCMS/OrchardCore · error · Error

No method defined.

Error message

No method defined.

What it means

FetchHttpClient.send throws 'No method defined.' when the HttpRequest's method property is empty or undefined. The HTTP client requires an explicit HTTP verb on every request it dispatches. This guards against malformed internally-constructed requests.

Solutions

  1. Set the method explicitly: `new HttpRequest('POST', url, content)` or `request.method = 'POST'`
  2. If using HubConnection/HttpConnection high-level APIs, let the library construct requests instead of calling send() directly
  3. Verify any custom HttpConnection middleware preserves request.method

Example fix

// before
const request = new HttpRequest(undefined, 'https://host/negotiate');
await httpClient.send(request);
// after
const request = new HttpRequest('POST', 'https://host/negotiate');
await httpClient.send(request);
Defensive patterns

Strategy: validation

Validate before calling

if (!request || typeof request.method !== 'string' || !request.method) throw new Error('request.method required');

Type guard

const hasMethod = (r) => typeof r?.method === 'string' && r.method.length > 0;

Try / catch

try { await client.send(request); } catch (e) { if (e.message === 'No method defined.') { request.method = 'POST'; await client.send(request); } }

Prevention

When it happens

Trigger: Invoking the low-level IHttpConnection.send(request) / HttpClient.send with a request object whose `method` field was never set; constructing an HttpRequest manually without `{ method: 'POST' }`.

Common situations: Custom transport or reconnect wrapper code building raw HttpRequest objects; version drift where a custom negotiate/sending layer omits method; typo like `methd` in a hand-built request object.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of OrchardCMS/OrchardCore@4306c0717f (2026-09-13). Data as JSON: /api/errors/e81915272c8bc271. Report an issue: GitHub.

Appendix: source

Thrown at src/OrchardCore.Modules/OrchardCore.SignalR/wwwroot/Scripts/signalr.js:606

        if (typeof AbortController === "undefined") {
            // In order to ignore the dynamic require in webpack builds we need to do this magic
            // @ts-ignore: TS doesn't know about these names
            const requireFunc =  true ? require : 0;
            // Node needs EventListener methods on AbortController which our custom polyfill doesn't provide
            this._abortControllerType = requireFunc("abort-controller");
        }
        else {
            this._abortControllerType = AbortController;
        }
    }
    /** @inheritDoc */
    async send(request) {
        // Check that abort was not signaled before calling send
        if (request.abortSignal && request.abortSignal.aborted) {
            throw new AbortError();
        }
        if (!request.method) {
            throw new Error("No method defined.");
        }
        if (!request.url) {
            throw new Error("No url defined.");
        }
        const abortController = new this._abortControllerType();
        let error;
        // Hook our abortSignal into the abort controller
        if (request.abortSignal) {
            request.abortSignal.onabort = () => {
                abortController.abort();
                error = new AbortError();
            };
        }
        // If a timeout has been passed in, setup a timeout to call abort
        // Type needs to be any to fit window.setTimeout and NodeJS.setTimeout
        let timeoutId = null;
        if (request.timeout) {
            const msTimeout = request.timeout;

View on GitHub (pinned to 4306c0717f)