@@ -93,10 +93,14 @@ impl RelayInformationDocument {
93
93
. get ( url. to_string ( ) )
94
94
. header ( "Accept" , "application/nostr+json" ) ;
95
95
match req. send ( ) . await {
96
- Ok ( response) => match response. json ( ) . await {
97
- Ok ( json) => Ok ( json) ,
98
- Err ( _) => Err ( Error :: InvalidInformationDocument ) ,
99
- } ,
96
+ Ok ( response) => {
97
+ let json: String = response. text ( ) . await ?;
98
+ tracing:: debug!( "Response: {json}" ) ;
99
+ match serde_json:: from_slice ( json. as_bytes ( ) ) {
100
+ Ok ( json) => Ok ( json) ,
101
+ Err ( _) => Err ( Error :: InvalidInformationDocument ) ,
102
+ }
103
+ }
100
104
Err ( _) => Err ( Error :: InaccessibleInformationDocument ) ,
101
105
}
102
106
}
@@ -118,10 +122,14 @@ impl RelayInformationDocument {
118
122
. get ( url. to_string ( ) )
119
123
. header ( "Accept" , "application/nostr+json" ) ;
120
124
match req. send ( ) {
121
- Ok ( response) => match response. json ( ) {
122
- Ok ( json) => Ok ( json) ,
123
- Err ( _) => Err ( Error :: InvalidInformationDocument ) ,
124
- } ,
125
+ Ok ( response) => {
126
+ let json: String = response. text ( ) ?;
127
+ tracing:: debug!( "Response: {json}" ) ;
128
+ match serde_json:: from_slice ( json. as_bytes ( ) ) {
129
+ Ok ( json) => Ok ( json) ,
130
+ Err ( _) => Err ( Error :: InvalidInformationDocument ) ,
131
+ }
132
+ }
125
133
Err ( _) => Err ( Error :: InaccessibleInformationDocument ) ,
126
134
}
127
135
}
@@ -137,10 +145,14 @@ impl RelayInformationDocument {
137
145
. get ( url. to_string ( ) )
138
146
. header ( "Accept" , "application/nostr+json" ) ;
139
147
match req. send ( ) . await {
140
- Ok ( response) => match response. json ( ) . await {
141
- Ok ( json) => Ok ( json) ,
142
- Err ( _) => Err ( Error :: InvalidInformationDocument ) ,
143
- } ,
148
+ Ok ( response) => {
149
+ let json: String = response. text ( ) . await ?;
150
+ tracing:: debug!( "Response: {json}" ) ;
151
+ match serde_json:: from_slice ( json. as_bytes ( ) ) {
152
+ Ok ( json) => Ok ( json) ,
153
+ Err ( _) => Err ( Error :: InvalidInformationDocument ) ,
154
+ }
155
+ }
144
156
Err ( _) => Err ( Error :: InaccessibleInformationDocument ) ,
145
157
}
146
158
}
0 commit comments