-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
π₯ feat: Add support for CBOR encoding (#3173)
* feat(cbor): allow encoding response bodies in cbor * fix(tests::cbor): encode struct instead of a randomly ordered hashmap * docs(whats_new): add cbor in context section * feat(binder): introduce CBOR * feat(client): allow cbor in fiber client * chore(tests): add more test * chore(packages): go mod tidy * fix(binder): update CBOR name and test * improve test coverage * improve test coverage * update1 * add docs * doc fixes * update * Fix markdown lint * Add missing entry from binder README * add/refresh documentation --------- Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com> Co-authored-by: M. Efe Γetin <efectn@protonmail.com> Co-authored-by: RW <rene@gofiber.io>
- Loading branch information
1 parent
89452fe
commit 26cc477
Showing
37 changed files
with
760 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package binder | ||
|
||
import ( | ||
"github.com/gofiber/utils/v2" | ||
) | ||
|
||
// cborBinding is the CBOR binder for CBOR request body. | ||
type cborBinding struct{} | ||
|
||
// Name returns the binding name. | ||
func (*cborBinding) Name() string { | ||
return "cbor" | ||
} | ||
|
||
// Bind parses the request body as CBOR and returns the result. | ||
func (*cborBinding) Bind(body []byte, cborDecoder utils.CBORUnmarshal, out any) error { | ||
return cborDecoder(body, out) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
26cc477
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold
1.50
.Benchmark_Ctx_Send
7.132
ns/op 0 B/op 0 allocs/op4.335
ns/op 0 B/op 0 allocs/op1.65
Benchmark_Ctx_Send - ns/op
7.132
ns/op4.335
ns/op1.65
Benchmark_Ctx_SendString_B
15.56
ns/op 0 B/op 0 allocs/op7.764
ns/op 0 B/op 0 allocs/op2.00
Benchmark_Ctx_SendString_B - ns/op
15.56
ns/op7.764
ns/op2.00
Benchmark_Utils_GetOffer/1_parameter
212.2
ns/op 0 B/op 0 allocs/op131
ns/op 0 B/op 0 allocs/op1.62
Benchmark_Utils_GetOffer/1_parameter - ns/op
212.2
ns/op131
ns/op1.62
Benchmark_Middleware_BasicAuth - B/op
80
B/op48
B/op1.67
Benchmark_Middleware_BasicAuth - allocs/op
5
allocs/op3
allocs/op1.67
Benchmark_Middleware_BasicAuth_Upper - B/op
80
B/op48
B/op1.67
Benchmark_Middleware_BasicAuth_Upper - allocs/op
5
allocs/op3
allocs/op1.67
Benchmark_CORS_NewHandler - B/op
16
B/op0
B/op+β
Benchmark_CORS_NewHandler - allocs/op
1
allocs/op0
allocs/op+β
Benchmark_CORS_NewHandlerSingleOrigin - B/op
16
B/op0
B/op+β
Benchmark_CORS_NewHandlerSingleOrigin - allocs/op
1
allocs/op0
allocs/op+β
Benchmark_CORS_NewHandlerPreflight - B/op
104
B/op0
B/op+β
Benchmark_CORS_NewHandlerPreflight - allocs/op
5
allocs/op0
allocs/op+β
Benchmark_CORS_NewHandlerPreflightSingleOrigin - B/op
104
B/op0
B/op+β
Benchmark_CORS_NewHandlerPreflightSingleOrigin - allocs/op
5
allocs/op0
allocs/op+β
Benchmark_CORS_NewHandlerPreflightWildcard - B/op
104
B/op0
B/op+β
Benchmark_CORS_NewHandlerPreflightWildcard - allocs/op
5
allocs/op0
allocs/op+β
Benchmark_Middleware_CSRF_GenerateToken - B/op
519
B/op327
B/op1.59
Benchmark_Middleware_CSRF_GenerateToken - allocs/op
10
allocs/op6
allocs/op1.67
This comment was automatically generated by workflow using github-action-benchmark.