Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

254
Visualizações
FastAPI: use HTTP 1.0 server

I have a simple HTTP API server

from typing import Dict

import uvicorn
from fastapi import FastAPI

app = FastAPI()


@app.post("/data/{uid}")
def data_post(uid: str, data: Dict):
    print(f"recieved data for {uid}: {data}")


if __name__ == "__main__":
    uvicorn.run(app)

Currently I am running it with uvicorn but this is not a requirement (other ASGI servers could work as well)

My problem is that the clients that call this API use HTTP 1.0 but the server responds with HTTP 1.1

curl -v --http1.0 -H "Content-Type: application/json" -d '{"a": 123, "b":"test"}' localhost:8000/data/123abc
*   Trying 127.0.0.1:8000...
* Connected to localhost (127.0.0.1) port 8000 (#0)
> POST /data/123abc HTTP/1.0
> Host: localhost:8000
> User-Agent: curl/7.77.0
> Accept: */*
> Content-Type: application/json
> Content-Length: 22
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< date: Mon, 24 Jan 2022 13:43:12 GMT
< server: uvicorn
< content-length: 4
< content-type: application/json
< Connection: close
< 
* Closing connection 0

I would like to know if there is a way to configure uvicorn to use HTTP 1.0 or if there is another ASGI server that can be used with FastAPI applications that can achieve this.

Unfortunatelly I can not change the clients (they are a third party product) and currently they do not support HTTP 1.1.

over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda