mirror of
https://github.com/storytold/voder-proxy.git
synced 2026-10-19 07:43:12 +00:00
Broke OPTION / CORS by not matching on method
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "tts-service-proxy"
|
||||
edition = "2018"
|
||||
version = "0.0.1"
|
||||
version = "0.0.2"
|
||||
authors = [
|
||||
"Brandon Thomas <bt@brand.io>",
|
||||
"Brandon Thomas <echelon@gmail.com>",
|
||||
|
||||
+5
-5
@@ -9,10 +9,10 @@ pub mod speak_proxy;
|
||||
use anyhow::Result as AnyhowResult;
|
||||
use crate::newrelic_logger::NewRelicLogger;
|
||||
use crate::speak_proxy::speak_proxy_with_retry;
|
||||
use hyper::StatusCode;
|
||||
use hyper::server::conn::AddrStream;
|
||||
use hyper::service::{service_fn, make_service_fn};
|
||||
use hyper::{Body, Request, Response, Server};
|
||||
use hyper::{StatusCode, Method};
|
||||
use rand::seq::IteratorRandom;
|
||||
use std::collections::HashMap;
|
||||
use std::convert::Infallible;
|
||||
@@ -125,8 +125,8 @@ pub async fn handle(
|
||||
newrelic_logger: Arc<NewRelicLogger>,
|
||||
server_params: ServerParams) -> Result<Response<Body>, Infallible>
|
||||
{
|
||||
match req.uri().path() {
|
||||
"/speak" => {
|
||||
match (req.method(), req.uri().path()) {
|
||||
(&Method::POST, "/speak") => {
|
||||
let nr_transaction = newrelic_logger.web_transaction("/speak");
|
||||
let result = speak_proxy_with_retry(
|
||||
client_ip,
|
||||
@@ -141,7 +141,7 @@ pub async fn handle(
|
||||
Err(error) => Ok(error.to_response()),
|
||||
}
|
||||
},
|
||||
"/speak_spectrogram" => {
|
||||
(&Method::POST, "/speak_spectrogram") => {
|
||||
let nr_transaction = newrelic_logger.web_transaction("/speak_spectrogram");
|
||||
let result = speak_proxy_with_retry(
|
||||
client_ip,
|
||||
@@ -156,7 +156,7 @@ pub async fn handle(
|
||||
Err(error) => Ok(error.to_response()),
|
||||
}
|
||||
},
|
||||
"/proxy_health" => {
|
||||
(&Method::GET, "/proxy_health") => {
|
||||
let _droppable_transaction = newrelic_logger.web_transaction("/proxy_health");
|
||||
health_check_response(req)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user