+38
src/http/handle_xrpc_resolve_handle.rs
+38
src/http/handle_xrpc_resolve_handle.rs
···
211
211
212
212
Ok(response)
213
213
}
214
+
215
+
pub(super) async fn handle_xrpc_resolve_handle_options() -> Response {
216
+
let mut response = StatusCode::NO_CONTENT.into_response();
217
+
let headers = response.headers_mut();
218
+
219
+
// Add CORS and Allow headers for OPTIONS request
220
+
headers.insert("Allow", HeaderValue::from_static("GET, HEAD, OPTIONS"));
221
+
headers.insert(
222
+
header::ACCESS_CONTROL_ALLOW_HEADERS,
223
+
HeaderValue::from_static("*"),
224
+
);
225
+
headers.insert(
226
+
header::ACCESS_CONTROL_ALLOW_METHODS,
227
+
HeaderValue::from_static("GET, HEAD, OPTIONS"),
228
+
);
229
+
headers.insert(
230
+
header::ACCESS_CONTROL_ALLOW_ORIGIN,
231
+
HeaderValue::from_static("*"),
232
+
);
233
+
headers.insert(
234
+
header::ACCESS_CONTROL_EXPOSE_HEADERS,
235
+
HeaderValue::from_static("*"),
236
+
);
237
+
headers.insert(
238
+
header::ACCESS_CONTROL_MAX_AGE,
239
+
HeaderValue::from_static("86400"),
240
+
);
241
+
headers.insert(
242
+
"Access-Control-Request-Headers",
243
+
HeaderValue::from_static("*"),
244
+
);
245
+
headers.insert(
246
+
"Access-Control-Request-Method",
247
+
HeaderValue::from_static("GET"),
248
+
);
249
+
250
+
response
251
+
}
+2
-1
src/http/server.rs
+2
-1
src/http/server.rs
···
90
90
.route("/xrpc/_health", get(handle_xrpc_health))
91
91
.route(
92
92
"/xrpc/com.atproto.identity.resolveHandle",
93
-
get(super::handle_xrpc_resolve_handle::handle_xrpc_resolve_handle),
93
+
get(super::handle_xrpc_resolve_handle::handle_xrpc_resolve_handle)
94
+
.options(super::handle_xrpc_resolve_handle::handle_xrpc_resolve_handle_options),
94
95
)
95
96
.with_state(app_context)
96
97
}