npm.io
25.2.0 • Published yesterday

@whook/method-override

Licence
MIT
Version
25.2.0
Deps
4
Size
28 kB
Vulns
0
Weekly
0
Stars
31

@whook/method-override

A wrapper for the Whook HTTP Transaction service to handle patch method compatibility.

GitHub license

To use this Whook module, simply override the httpTransaction service into your main file (usually in src/index.ts):

+import { initHTTPTransaction } from '@whook/whook';
+import wrapHTTPTransactionWithMethodOverride from '@whook/method-override';

// (...)

// The `prepareEnvironment` one is intended to prepare the server environment
export async function prepareEnvironment(
  $: Knifecycle = new Knifecycle(),
): Promise<Knifecycle> {
  $ = await prepareBaseEnvironment($);

  // (...)

+  // Add method override to the server
+  $.register(
+    wrapHTTPTransactionWithMethodOverride(initHTTPTransaction),
+  );

  return $;
}

// (...)

API

Authors

License

MIT

Keywords