set json header, get rid of redundant host output in bail message
This commit is contained in:
		
							parent
							
								
									4b79a621fb
								
							
						
					
					
						commit
						e9f9e35c9d
					
				
					 2 changed files with 8 additions and 4 deletions
				
			
		|  | @ -455,7 +455,7 @@ pub async fn index_server(server: Arc<RelayServer>, host: String) -> Result<()> | |||
|     { | ||||
|         let mut active_indexers = server.active_indexers.lock().await; | ||||
|         if active_indexers.contains(&host) { | ||||
|             bail!("Indexer already running for host {}", &host); | ||||
|             bail!("Indexer already running for host"); | ||||
|         } | ||||
| 
 | ||||
|         active_indexers.insert(host.clone()); | ||||
|  |  | |||
|  | @ -21,9 +21,12 @@ pub async fn handle_request_crawl( | |||
|         Ok(input) => input, | ||||
|         Err(_) => { | ||||
|             // TODO: surely we can build out an XRPC abstraction or something
 | ||||
|             return Ok(Response::builder().status(400).body(body_full( | ||||
|                 r#"{"error":"InvalidRequest","message":"Failed to parse request body"}"#, | ||||
|             ))?); | ||||
|             return Ok(Response::builder() | ||||
|                 .status(400) | ||||
|                 .header("Content-Type", "application/json") | ||||
|                 .body(body_full( | ||||
|                     r#"{"error":"InvalidRequest","message":"Failed to parse request body"}"#, | ||||
|                 ))?); | ||||
|         } | ||||
|     }; | ||||
| 
 | ||||
|  | @ -36,5 +39,6 @@ pub async fn handle_request_crawl( | |||
| 
 | ||||
|     Ok(Response::builder() | ||||
|         .status(200) | ||||
|         .header("Content-Type", "application/json") | ||||
|         .body(body_full(r#"{"status":"ok"}"#))?) | ||||
| } | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue