Challenge.fromResponse
Extract a Challenge from a Response
Extracts the Challenge from a Response's WWW-Authenticate header.
Usage
import { } from 'mppx'
const = await ('/resource')
if (. === 402) {
const = .()
}With method type narrowing
Use a method definition to get type-safe access to method-specific request fields.
import { } from 'mppx'
import { } from 'mppx/tempo'
const = await ('/resource')
if (. === 402) {
const = .(, { : [.] })
}Return type
type ReturnType = ChallengeThe deserialized Challenge object.
Parameters
options (optional)
- Type:
{ methods?: readonly Method.Method[] }
Optional settings to narrow the Challenge type using method intents.
response
- Type:
Response
The HTTP response (must be 402 status).