Lime Web Components API Documentation - v7.4.0
    Preparing search index...

    Variable HttpMethodConst

    HttpMethod: {
        Delete: "DELETE";
        Get: "GET";
        Patch: "PATCH";
        Post: "POST";
        Put: "PUT";
    } = ...

    HTTP method constants

    Standard HTTP methods as constant values. Useful for type-safe method selection in custom HTTP utilities.

    Type Declaration

    • ReadonlyDelete: "DELETE"
    • ReadonlyGet: "GET"
    • ReadonlyPatch: "PATCH"
    • ReadonlyPost: "POST"
    • ReadonlyPut: "PUT"
    import { HttpMethod, PlatformServiceName } from '@limetech/lime-web-components';

    const http = platform.get(PlatformServiceName.Http);

    function sendUser(method: HttpMethod) {
    const user = { name: 'Jane Smith', email: 'jane@example.com' };

    if (method === HttpMethod.Put) {
    return http.put('my_addon/users/123', user);
    }

    return http.post('my_addon/users', user);
    }

    const saved = await sendUser(HttpMethod.Put);