Skip to content

Commit

Permalink
feat: handle OPTIONS request (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
xsigoking authored Apr 23, 2024
1 parent 9f5c87c commit b029db1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ impl Server {
self.chat_completion(req).await
} else if method == Method::GET && uri == "/v1/models" {
self.models(req).await
} else if method == Method::OPTIONS
&& (uri == "/v1/chat/completions" || uri == "/v1/models")
{
status = StatusCode::NO_CONTENT;
Ok(Response::default())
} else {
status = StatusCode::NOT_FOUND;
Err(anyhow!("The requested endpoint was not found."))
Expand Down

0 comments on commit b029db1

Please sign in to comment.