Skip to main content

refused

Function refused 

Source
pub fn refused(refusal: Refusal) -> Response<Vec<u8>>
Expand description

The answer refusing a request for refusal’s reason: its status, why in plain text, and the contract’s headers, so any origin reads it. An adapter’s own refusal, such as having no bundle, is answered with it too.

use compmd_host::{Refusal, refused};

let response = refused(Refusal { status: http::StatusCode::NOT_FOUND, why: "this app has no bundle" });
assert_eq!(response.headers()["access-control-allow-origin"], "*");