Define RequestTarget
This commit is contained in:
parent
bd1caaf5da
commit
191239584b
@ -164,7 +164,7 @@ where
|
|||||||
.headers(headers.clone())
|
.headers(headers.clone())
|
||||||
.header(
|
.header(
|
||||||
"Signature",
|
"Signature",
|
||||||
request::signature(sender, &headers, "post", url.path(), url.query())
|
request::signature(sender, &headers, ("post", url.path(), url.query()))
|
||||||
.expect("activity_pub::broadcast: request signature error"),
|
.expect("activity_pub::broadcast: request signature error"),
|
||||||
)
|
)
|
||||||
.body(body)
|
.body(body)
|
||||||
|
@ -115,14 +115,14 @@ pub fn headers() -> HeaderMap {
|
|||||||
type Method<'a> = &'a str;
|
type Method<'a> = &'a str;
|
||||||
type Path<'a> = &'a str;
|
type Path<'a> = &'a str;
|
||||||
type Query<'a> = &'a str;
|
type Query<'a> = &'a str;
|
||||||
|
type RequestTarget<'a> = (Method<'a>, Path<'a>, Option<Query<'a>>);
|
||||||
|
|
||||||
pub fn signature<S: Signer>(
|
pub fn signature<S: Signer>(
|
||||||
signer: &S,
|
signer: &S,
|
||||||
headers: &HeaderMap,
|
headers: &HeaderMap,
|
||||||
method: Method,
|
request_target: RequestTarget,
|
||||||
path: Path,
|
|
||||||
query: Option<Query>,
|
|
||||||
) -> Result<HeaderValue, Error> {
|
) -> Result<HeaderValue, Error> {
|
||||||
|
let (method, path, query) = request_target;
|
||||||
let origin_form = if let Some(query) = query {
|
let origin_form = if let Some(query) = query {
|
||||||
format!("{}?{}", path, query)
|
format!("{}?{}", path, query)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user