@@ -238,10 +238,10 @@ pub(super) async fn content(
238
238
Ok (
239
239
content_response (
240
240
& server_config,
241
- inscription,
242
241
inscription_id,
243
242
accept_encoding,
244
243
sec_fetch_dest,
244
+ inscription,
245
245
) ?
246
246
. ok_or_not_found ( || format ! ( "inscription {inscription_id} content" ) ) ?
247
247
. into_response ( ) ,
@@ -293,11 +293,10 @@ impl IntoResponse for ContentResponse {
293
293
294
294
pub ( crate ) fn content_response (
295
295
server_config : & ServerConfig ,
296
- // todo: Swap these?
297
- inscription : Inscription ,
298
296
inscription_id : InscriptionId ,
299
297
accept_encoding : AcceptEncoding ,
300
298
sec_fetch_dest : SecFetchDest ,
299
+ inscription : Inscription ,
301
300
) -> ServerResult < Option < ContentResponse > > {
302
301
if sec_fetch_dest == SecFetchDest :: Document {
303
302
return Ok ( Some ( ContentResponse {
@@ -649,10 +648,10 @@ pub(super) async fn undelegated_content(
649
648
Ok (
650
649
r:: content_response (
651
650
& server_config,
652
- inscription,
653
651
inscription_id,
654
652
accept_encoding,
655
653
sec_fetch_dest,
654
+ inscription,
656
655
) ?
657
656
. ok_or_not_found ( || format ! ( "inscription {inscription_id} content" ) ) ?
658
657
. into_response ( ) ,
@@ -668,14 +667,14 @@ mod tests {
668
667
fn content_response_no_content_type ( ) {
669
668
let content_response = r:: content_response (
670
669
& ServerConfig :: default ( ) ,
670
+ inscription_id ( 0 ) ,
671
+ AcceptEncoding :: default ( ) ,
672
+ SecFetchDest :: Other ,
671
673
Inscription {
672
674
content_type : None ,
673
675
body : Some ( Vec :: new ( ) ) ,
674
676
..default ( )
675
677
} ,
676
- inscription_id ( 0 ) ,
677
- AcceptEncoding :: default ( ) ,
678
- SecFetchDest :: Other ,
679
678
)
680
679
. unwrap ( )
681
680
. unwrap ( ) ;
@@ -688,14 +687,14 @@ mod tests {
688
687
fn content_response_bad_content_type ( ) {
689
688
let content_response = r:: content_response (
690
689
& ServerConfig :: default ( ) ,
690
+ inscription_id ( 0 ) ,
691
+ AcceptEncoding :: default ( ) ,
692
+ SecFetchDest :: Other ,
691
693
Inscription {
692
694
content_type : Some ( "\n " . as_bytes ( ) . to_vec ( ) ) ,
693
695
body : Some ( Vec :: new ( ) ) ,
694
696
..Default :: default ( )
695
697
} ,
696
- inscription_id ( 0 ) ,
697
- AcceptEncoding :: default ( ) ,
698
- SecFetchDest :: Other ,
699
698
)
700
699
. unwrap ( )
701
700
. unwrap ( ) ;
@@ -708,14 +707,14 @@ mod tests {
708
707
fn content_response_no_content ( ) {
709
708
assert ! ( r:: content_response(
710
709
& ServerConfig :: default ( ) ,
710
+ inscription_id( 0 ) ,
711
+ AcceptEncoding :: default ( ) ,
712
+ SecFetchDest :: Other ,
711
713
Inscription {
712
714
content_type: Some ( "text/plain" . as_bytes( ) . to_vec( ) ) ,
713
715
body: None ,
714
716
..default ( )
715
717
} ,
716
- inscription_id( 0 ) ,
717
- AcceptEncoding :: default ( ) ,
718
- SecFetchDest :: Other ,
719
718
)
720
719
. unwrap( )
721
720
. is_none( ) ) ;
@@ -725,14 +724,14 @@ mod tests {
725
724
fn content_response_with_content ( ) {
726
725
let response = r:: content_response (
727
726
& ServerConfig :: default ( ) ,
727
+ inscription_id ( 0 ) ,
728
+ AcceptEncoding :: default ( ) ,
729
+ SecFetchDest :: Other ,
728
730
Inscription {
729
731
content_type : Some ( "text/plain" . as_bytes ( ) . to_vec ( ) ) ,
730
732
body : Some ( vec ! [ 1 , 2 , 3 ] ) ,
731
733
..default ( )
732
734
} ,
733
- inscription_id ( 0 ) ,
734
- AcceptEncoding :: default ( ) ,
735
- SecFetchDest :: Other ,
736
735
)
737
736
. unwrap ( )
738
737
. unwrap ( ) ;
@@ -745,14 +744,14 @@ mod tests {
745
744
fn content_security_policy_no_origin ( ) {
746
745
let response = r:: content_response (
747
746
& ServerConfig :: default ( ) ,
747
+ inscription_id ( 0 ) ,
748
+ AcceptEncoding :: default ( ) ,
749
+ SecFetchDest :: Other ,
748
750
Inscription {
749
751
content_type : Some ( "text/plain" . as_bytes ( ) . to_vec ( ) ) ,
750
752
body : Some ( vec ! [ 1 , 2 , 3 ] ) ,
751
753
..default ( )
752
754
} ,
753
- inscription_id ( 0 ) ,
754
- AcceptEncoding :: default ( ) ,
755
- SecFetchDest :: Other ,
756
755
)
757
756
. unwrap ( )
758
757
. unwrap ( ) ;
@@ -770,14 +769,14 @@ mod tests {
770
769
csp_origin : Some ( "https://ordinals.com" . into ( ) ) ,
771
770
..default ( )
772
771
} ,
772
+ inscription_id ( 0 ) ,
773
+ AcceptEncoding :: default ( ) ,
774
+ SecFetchDest :: Other ,
773
775
Inscription {
774
776
content_type : Some ( "text/plain" . as_bytes ( ) . to_vec ( ) ) ,
775
777
body : Some ( vec ! [ 1 , 2 , 3 ] ) ,
776
778
..default ( )
777
779
} ,
778
- inscription_id ( 0 ) ,
779
- AcceptEncoding :: default ( ) ,
780
- SecFetchDest :: Other ,
781
780
)
782
781
. unwrap ( )
783
782
. unwrap ( ) ;
0 commit comments