# `whenPOST` ( service in module `ngMockE2E` )

## Description

Creates a new backend definition for POST requests. For more info see `when()` .

## Parameters

- `url – {string|RegExp} –`

  HTTP url.

- `data(optional) – {(string|RegExp)=} –`

  HTTP request body.

- `headers(optional) – {(Object|function(Object))=} –`

  HTTP headers.

## Returns

`{requestHandler}` –

Returns an object with `respond` and `passThrough` methods that control how a matched request is handled.