Empty string cannot be passed in HttpTrigger query string
Evaluación
Este issue todavía no se ha evaluado.
Descripción
Repro steps
- Run the following function from templates:
package com.function;
import java.util.*;
import com.microsoft.azure.functions.annotation.*;
import com.microsoft.azure.functions.*;
/**
* Azure Functions with HTTP Trigger.
*/
public class HttpTriggerJava1 {
/**
* This function listens at endpoint "/api/HttpTriggerJava1". Two ways to invoke it using "curl" command in bash:
* 1. curl -d "HTTP Body" {your host}/api/HttpTriggerJava1
* 2. curl {your host}/api/HttpTriggerJava1?name=HTTP%20Query
*/
@FunctionName("HttpTriggerJava1")
public HttpResponseMessage run(
@HttpTrigger(name = "req", methods = {HttpMethod.GET, HttpMethod.POST}, authLevel = AuthorizationLevel.FUNCTION) HttpRequestMessage<Optional<String>> request,
final ExecutionContext context) {
context.getLogger().info("Java HTTP trigger processed a request.");
// Parse query parameter
String query = request.getQueryParameters().get("name");
String name = request.getBody().orElse(query);
if (name == null) {
return request.createResponseBuilder(HttpStatus.BAD_REQUEST).body("Please pass a name on the query string or in the request body").build();
} else {
return request.createResponseBuilder(HttpStatus.OK).body("Hello, " + name).build();
}
}
}
- Send the following request: http://localhost:7071/api/HttpTriggerJava1?name=
Expected behavior
name should be set to an empty string and the function should return "Hello, "
Actual behavior
name is set to null and the function returns "Please pass a name on the query string or in the request body"
Known workarounds
None
Related information
Similar issue in PowerShell worker: https://github.com/Azure/azure-functions-powershell-worker/issues/895
- Lenguaje dominante
- Java
- Estrellas
- 103
- Forks
- 74
- Merge medio
- 12 h 49 min
- PR fusionados (30 d)
- 2
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Azure/azure-functions-java-worker
-
[Feature] Support raw Kafka record (KafkaRecord) binding with Protobuf deserializationPosiblemente ocupada @TsuyoshiUshio la tomó hace 175 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 50/100
-
[Feature] Support for reverse propagation of request telemetry tagsPosiblemente ocupada @arnabnandy7 la tomó hace 69 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
-
[Feature] Support OpenTelemetry BaggagePosiblemente ocupada @arnabnandy7 la tomó hace 69 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
-
mcp-extension
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
-
Add advanced MCP tool samplesQuizá libre de nuevo @ahmedmuhsin la tomó hace 185 días y no hay ningún pull request abierto. Abiertomcp-extension
Azure/azure-functions-java-worker#863 · 1 asignado ·
Todos los issues de Azure/azure-functions-java-worker
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
scylladb/scylla-cdc-source-connector#350 ·
Los mantenedores suelen responder en 1 día
-
agent:working documentation enhancement go:build lane:needs-decision
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Sanne/incus-spawn#1435 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
area:shuffle bug priority:high requires-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
apache/datafusion-comet#7062 ·
Los mantenedores suelen responder en 1 día
-
wait for review
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
enhancement good first issue up-for-grabs
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
AnikethTS/ChangeRadar#22 ·
Los mantenedores suelen responder en 1 día