Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Consider automatic incoming entity collection to simplify API (discuss)

Abierto
#461 1 comentario 3 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
25/100
Tipo de issue
Nueva funcionalidad
Claridad
Necesita aclaración
Estado de actividad
Activo
Stack tecnológico
scala
Área
api, backend

Línea de trabajo

Comienza examinando las APIs públicas de HttpEntity.Strict y HttpEntity.Default y el comportamiento descrito en #460. Compara la conversión automática a strict, la documentación y el ocultamiento de los detalles internos del streaming, prestando especial atención a los límites fijos, el dispatch diferido y la migración al streaming. Done no está definido en el issue; un colaborador tendría que tomar primero una decisión de diseño y acordar el alcance.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

enhancement

One of the oldest issues with akka-http/pekko-http is the distinction between HttpEntity.Strict and HttpEntity.Default that cannot be observed on the wire but leads to different API behavior for the user just based on the timing with which data is received.

Strict contains an in-memory copy of the full data, while Default contains a live stream that is still connected to the connection.

The rationale for this API is that we want to supply a streaming API whenever it makes sense to 1. provide data to the user in real time as it comes in and 2. to avoid having to load all data into memory but have all the nice properties of streams like end-to-end backpressure and limited memory usage.

The backside is that while the current solution gives you all the options to deal with a real time situation optimally, it also requires you to deal with all these cases (or use toStrict in more cases).

However, this often trips up users (like in #460) where depending on the environment the exact same request can lead to different runtime behavior. Often, when running tests locally, it is much more likely that requests end up as Strict while in production, Default becomes more likely. In situations like #460, the effect can be really subtle and hard to understand.

One potential solution could be to auto-strictify incoming entities for simplicity. In that case, we would always read incoming entities to their completion (up to a fixed limit) and delay dispatching the incoming HTTP message until the full message is there. The benefit would be that users of simple applications would get every message with a strict entity.

The downside is that I can see no gradual migration path once you need streaming behavior for certain entities. Then you would still have to enable streaming for the whole application which then might not be expecting streaming entities...

Alternatives:

  • (even) better documentation to educate about the way things work
  • try to remove Strict from the public API (very intrusive and subtle issues like #460 will not be solved that way)
  • improve library to mitigate impact / hide internals of the streaming API further

(I have not convinced myself yet that we can or should change something right now without making other cases worse but still wanted to keep a note here)

Lenguaje dominante
Scala
Estrellas
196
Forks
56
Merge medio
1 d 18 h
PR fusionados (30 d)
43

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de apache/pekko-http

Todos los issues de apache/pekko-http

Issues similares

Más issues de Scala

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.