object
http_cors
Transport-neutral CORS request classification, preflight response generation, and response decoration helpers for normalized HTTP messages.
logtalk_load(http_cors(loader))static, context_switching_callsPublic predicates
request_origin/2
Returns the single request Origin header value when present.
staticrequest_origin(Request,Origin)request_origin(+compound,-atom) - zero_or_oneis_cors_request/1
Succeeds when the request carries a single Origin header value.
staticis_cors_request(Request)is_cors_request(+compound) - zero_or_oneis_preflight_request/1
Succeeds when the request is a CORS preflight request with method options and a single Access-Control-Request-Method header value.
staticis_preflight_request(Request)is_preflight_request(+compound) - zero_or_onepreflight_response/3
Builds a normalized CORS preflight response using the given policy options. Allowed preflight requests return 200 OK with the relevant Access-Control-* headers and denied requests return 403 Forbidden. Non-preflight requests raise an error.
staticpreflight_response(Request,Response,Options)preflight_response(+compound,-compound,+list(compound)) - one_or_errorRequest is not a CORS preflight request:domain_error(http_cors_preflight_request,Request)Options is a variable or a partial list:instantiation_errorOptions is neither a variable nor a list:type_error(list,Options)Option of the list Options is neither a variable nor a compound term:type_error(compound,Option)Option of the list Options is a compound term but not a valid option:domain_error(option,Option)Options contains an invalid CORS option combination:domain_error(http_cors_options,Options)domain_error(http_header_semantics,Header)add_response_headers/4
Decorates a normalized response with the relevant CORS response headers when the request matches and the policy allows it. Denied requests preserve or add cache-relevant Vary metadata but do not add permission headers.
staticadd_response_headers(Request,Response0,Response,Options)add_response_headers(+compound,+compound,-compound,+list(compound)) - one_or_errorOptions is a variable or a partial list:instantiation_errorOptions is neither a variable nor a list:type_error(list,Options)Option of the list Options is neither a variable nor a compound term:type_error(compound,Option)Option of the list Options is a compound term but not a valid option:domain_error(option,Option)Options contains an invalid CORS option combination:domain_error(http_cors_options,Options)Response0 is not a valid normalized HTTP response term:domain_error(http_response,Response0)domain_error(http_header_semantics,Header)Protected predicates
(no local declarations; see entity ancestors if any)
Private predicates
(no local declarations; see entity ancestors if any)
Operators
(none)