You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm encountering an issue with the ctx.Bind().JSON method in Fiber when binding JSON payloads that include specific multi-codepoint characters. When these characters are present in the request body, the binding process silently halts—no error is returned, and the request does not continue.
Steps to Reproduce:
Create a simple Fiber endpoint that uses ctx.Bind().JSON to bind incoming JSON to a struct.
Send a JSON payload where one of the fields contains characters such as:
"👁🗨💀🐱👤🐱💻"
"12345"
strings.Repeat("بA😊", 85) + "A" (or similar cases with complex emoji sequences)
Observe that the binding process does not complete and no error is logged.
Expected Behavior:
The JSON payload should be successfully bound to the struct even when it contains multi-codepoint characters, such as combined emojis or full-width characters.
Actual Behavior:
When the payload includes these characters, ctx.Bind().JSON does not proceed—it does not return an error nor does it complete the request processing, causing the request to hang.
Additional Information:
I have confirmed that the issue is not related to any custom middleware or third-party packages, as the problem persists even when binding to a raw struct without additional tags.
This issue is reproducible with the provided examples.
It seems related to how Fiber processes or decodes certain Unicode sequences during JSON binding.
Any assistance or insights into this problem would be greatly appreciated. Thank you!
How to Reproduce
1-Create a minimal Fiber server endpoint:
Set up an endpoint that binds the incoming JSON to a simple struct (e.g., one with a Name field) using ctx.Bind().JSON.
2-Prepare the JSON payload:
Construct a JSON payload that includes problematic characters. For example:
For the Name field, use: "👁🗨💀🐱👤🐱💻"
Alternatively, try other examples like "12345" or a string generated by strings.Repeat("بA😊", 85) + "A".
3-Send the request:
Use an HTTP client (e.g., Postman or curl) to send the JSON payload to your endpoint.
4-Observe the behavior:
Notice that the binding process hangs silently—no error is returned and the request does not complete.
In the expected outcome, the JSON should be successfully bound to the struct regardless of the characters used, and the request should complete normally.
Expected Behavior
When a JSON payload containing multi-codepoint characters is sent, ctx.Bind().JSON should successfully parse and bind the data to the target struct without hanging. For example, fields with values like "👁🗨💀🐱👤🐱💻", "12345", or strings generated by strings.Repeat("بA😊", 85) + "A" should be processed normally, and the request should complete with either a proper response or continue with subsequent middleware/handlers as expected.
Fiber Version
v3.0.0-beta.3
Code Snippet (optional)
package main
import (
"log""github.com/gofiber/fiber/v2"
)
typeRequestDatastruct {
Namestring`json:"name"`
}
funcmain() {
app:=fiber.New()
app.Post("/test", func(c*fiber.Ctx) error {
varreqDataRequestData// Attempt to bind JSON to the structerr:=c.Bind().JSON(&reqData)
iferr!=nil {
log.Printf("Binding error: %v", err)
returnc.Status(fiber.StatusBadRequest).SendString("Bad Request")
}
// If binding is successful, return the bound data as JSONreturnc.JSON(reqData)
})
log.Fatal(app.Listen(":3000"))
}
typeUsersstruct {
Namestring`json:"name"``
}
Thanks for opening your first issue here! 🎉 Be sure to follow the issue template! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord
Bug Description
I'm encountering an issue with the ctx.Bind().JSON method in Fiber when binding JSON payloads that include specific multi-codepoint characters. When these characters are present in the request body, the binding process silently halts—no error is returned, and the request does not continue.
Steps to Reproduce:
Create a simple Fiber endpoint that uses ctx.Bind().JSON to bind incoming JSON to a struct.
Send a JSON payload where one of the fields contains characters such as:
"👁🗨💀🐱👤🐱💻"
"12345"
strings.Repeat("بA😊", 85) + "A" (or similar cases with complex emoji sequences)
Observe that the binding process does not complete and no error is logged.
Expected Behavior:
The JSON payload should be successfully bound to the struct even when it contains multi-codepoint characters, such as combined emojis or full-width characters.
Actual Behavior:
When the payload includes these characters, ctx.Bind().JSON does not proceed—it does not return an error nor does it complete the request processing, causing the request to hang.
Additional Information:
I have confirmed that the issue is not related to any custom middleware or third-party packages, as the problem persists even when binding to a raw struct without additional tags.
This issue is reproducible with the provided examples.
It seems related to how Fiber processes or decodes certain Unicode sequences during JSON binding.
Any assistance or insights into this problem would be greatly appreciated. Thank you!
How to Reproduce
1-Create a minimal Fiber server endpoint:
Set up an endpoint that binds the incoming JSON to a simple struct (e.g., one with a Name field) using ctx.Bind().JSON.
2-Prepare the JSON payload:
Construct a JSON payload that includes problematic characters. For example:
For the Name field, use: "👁🗨💀🐱👤🐱💻"
Alternatively, try other examples like "12345" or a string generated by strings.Repeat("بA😊", 85) + "A".
3-Send the request:
Use an HTTP client (e.g., Postman or curl) to send the JSON payload to your endpoint.
4-Observe the behavior:
Notice that the binding process hangs silently—no error is returned and the request does not complete.
In the expected outcome, the JSON should be successfully bound to the struct regardless of the characters used, and the request should complete normally.
Expected Behavior
When a JSON payload containing multi-codepoint characters is sent, ctx.Bind().JSON should successfully parse and bind the data to the target struct without hanging. For example, fields with values like "👁🗨💀🐱👤🐱💻", "12345", or strings generated by strings.Repeat("بA😊", 85) + "A" should be processed normally, and the request should complete with either a proper response or continue with subsequent middleware/handlers as expected.
Fiber Version
v3.0.0-beta.3
Code Snippet (optional)
Checklist:
The text was updated successfully, but these errors were encountered: