Skip to content

Commit 06dcc1d

Browse files
committed
Revise
1 parent 8730808 commit 06dcc1d

File tree

2 files changed

+22
-23
lines changed

2 files changed

+22
-23
lines changed

src/subcommand/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1492,10 +1492,10 @@ impl Server {
14921492
return Ok(
14931493
r::content_response(
14941494
&server_config,
1495-
inscription,
14961495
inscription_id,
14971496
accept_encoding,
14981497
sec_fetch_dest,
1498+
inscription,
14991499
)?
15001500
.ok_or_not_found(|| format!("inscription {inscription_id} content"))?
15011501
.into_response(),

src/subcommand/server/r.rs

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,10 @@ pub(super) async fn content(
238238
Ok(
239239
content_response(
240240
&server_config,
241-
inscription,
242241
inscription_id,
243242
accept_encoding,
244243
sec_fetch_dest,
244+
inscription,
245245
)?
246246
.ok_or_not_found(|| format!("inscription {inscription_id} content"))?
247247
.into_response(),
@@ -293,11 +293,10 @@ impl IntoResponse for ContentResponse {
293293

294294
pub(crate) fn content_response(
295295
server_config: &ServerConfig,
296-
// todo: Swap these?
297-
inscription: Inscription,
298296
inscription_id: InscriptionId,
299297
accept_encoding: AcceptEncoding,
300298
sec_fetch_dest: SecFetchDest,
299+
inscription: Inscription,
301300
) -> ServerResult<Option<ContentResponse>> {
302301
if sec_fetch_dest == SecFetchDest::Document {
303302
return Ok(Some(ContentResponse {
@@ -649,10 +648,10 @@ pub(super) async fn undelegated_content(
649648
Ok(
650649
r::content_response(
651650
&server_config,
652-
inscription,
653651
inscription_id,
654652
accept_encoding,
655653
sec_fetch_dest,
654+
inscription,
656655
)?
657656
.ok_or_not_found(|| format!("inscription {inscription_id} content"))?
658657
.into_response(),
@@ -668,14 +667,14 @@ mod tests {
668667
fn content_response_no_content_type() {
669668
let content_response = r::content_response(
670669
&ServerConfig::default(),
670+
inscription_id(0),
671+
AcceptEncoding::default(),
672+
SecFetchDest::Other,
671673
Inscription {
672674
content_type: None,
673675
body: Some(Vec::new()),
674676
..default()
675677
},
676-
inscription_id(0),
677-
AcceptEncoding::default(),
678-
SecFetchDest::Other,
679678
)
680679
.unwrap()
681680
.unwrap();
@@ -688,14 +687,14 @@ mod tests {
688687
fn content_response_bad_content_type() {
689688
let content_response = r::content_response(
690689
&ServerConfig::default(),
690+
inscription_id(0),
691+
AcceptEncoding::default(),
692+
SecFetchDest::Other,
691693
Inscription {
692694
content_type: Some("\n".as_bytes().to_vec()),
693695
body: Some(Vec::new()),
694696
..Default::default()
695697
},
696-
inscription_id(0),
697-
AcceptEncoding::default(),
698-
SecFetchDest::Other,
699698
)
700699
.unwrap()
701700
.unwrap();
@@ -708,14 +707,14 @@ mod tests {
708707
fn content_response_no_content() {
709708
assert!(r::content_response(
710709
&ServerConfig::default(),
710+
inscription_id(0),
711+
AcceptEncoding::default(),
712+
SecFetchDest::Other,
711713
Inscription {
712714
content_type: Some("text/plain".as_bytes().to_vec()),
713715
body: None,
714716
..default()
715717
},
716-
inscription_id(0),
717-
AcceptEncoding::default(),
718-
SecFetchDest::Other,
719718
)
720719
.unwrap()
721720
.is_none());
@@ -725,14 +724,14 @@ mod tests {
725724
fn content_response_with_content() {
726725
let response = r::content_response(
727726
&ServerConfig::default(),
727+
inscription_id(0),
728+
AcceptEncoding::default(),
729+
SecFetchDest::Other,
728730
Inscription {
729731
content_type: Some("text/plain".as_bytes().to_vec()),
730732
body: Some(vec![1, 2, 3]),
731733
..default()
732734
},
733-
inscription_id(0),
734-
AcceptEncoding::default(),
735-
SecFetchDest::Other,
736735
)
737736
.unwrap()
738737
.unwrap();
@@ -745,14 +744,14 @@ mod tests {
745744
fn content_security_policy_no_origin() {
746745
let response = r::content_response(
747746
&ServerConfig::default(),
747+
inscription_id(0),
748+
AcceptEncoding::default(),
749+
SecFetchDest::Other,
748750
Inscription {
749751
content_type: Some("text/plain".as_bytes().to_vec()),
750752
body: Some(vec![1, 2, 3]),
751753
..default()
752754
},
753-
inscription_id(0),
754-
AcceptEncoding::default(),
755-
SecFetchDest::Other,
756755
)
757756
.unwrap()
758757
.unwrap();
@@ -770,14 +769,14 @@ mod tests {
770769
csp_origin: Some("https://ordinals.com".into()),
771770
..default()
772771
},
772+
inscription_id(0),
773+
AcceptEncoding::default(),
774+
SecFetchDest::Other,
773775
Inscription {
774776
content_type: Some("text/plain".as_bytes().to_vec()),
775777
body: Some(vec![1, 2, 3]),
776778
..default()
777779
},
778-
inscription_id(0),
779-
AcceptEncoding::default(),
780-
SecFetchDest::Other,
781780
)
782781
.unwrap()
783782
.unwrap();

0 commit comments

Comments
 (0)