repo stringlengths 6 47 | file_url stringlengths 77 269 | file_path stringlengths 5 186 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-07 08:35:43 2026-01-07 08:55:24 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/middleware/basicauth/config.go | middleware/basicauth/config.go | package basicauth
import (
"crypto/sha256"
"crypto/sha512"
"crypto/subtle"
"encoding/base64"
"encoding/hex"
"errors"
"fmt"
"strconv"
"strings"
"github.com/gofiber/fiber/v3"
"github.com/gofiber/utils/v2"
"golang.org/x/crypto/bcrypt"
)
var ErrInvalidSHA256PasswordLength = errors.New("decode SHA256 password... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/middleware/basicauth/basicauth_test.go | middleware/basicauth/basicauth_test.go | package basicauth
import (
"crypto/sha256"
"crypto/sha512"
"encoding/base64"
"encoding/hex"
"fmt"
"io"
"net/http"
"net/http/httptest"
"strings"
"testing"
"github.com/gofiber/fiber/v3"
"github.com/stretchr/testify/require"
"github.com/valyala/fasthttp"
"golang.org/x/crypto/bcrypt"
)
func sha256Hash(p st... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/middleware/basicauth/basicauth.go | middleware/basicauth/basicauth.go | package basicauth
import (
"encoding/base64"
"errors"
"strings"
"unicode"
"unicode/utf8"
"github.com/gofiber/fiber/v3"
"github.com/gofiber/utils/v2"
"golang.org/x/text/unicode/norm"
)
// The contextKey type is unexported to prevent collisions with context keys defined in
// other packages.
type contextKey in... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/middleware/rewrite/rewrite_test.go | middleware/rewrite/rewrite_test.go | package rewrite
import (
"context"
"fmt"
"io"
"net/http"
"testing"
"github.com/gofiber/fiber/v3"
"github.com/stretchr/testify/require"
"github.com/valyala/fasthttp"
)
func Test_New(t *testing.T) {
// Test with no config
m := New()
if m == nil {
t.Error("Expected middleware to be returned, got nil")
}
... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/middleware/rewrite/config.go | middleware/rewrite/config.go | package rewrite
import (
"regexp"
"github.com/gofiber/fiber/v3"
)
// Config defines the config for middleware.
type Config struct {
// Next defines a function to skip middleware.
// Optional. Default: nil
Next func(fiber.Ctx) bool
// Rules defines the URL path rewrite rules. The values captured in asterisk ca... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/middleware/rewrite/rewrite.go | middleware/rewrite/rewrite.go | package rewrite
import (
"regexp"
"strconv"
"strings"
"github.com/gofiber/fiber/v3"
)
// New creates a new middleware handler
func New(config ...Config) fiber.Handler {
cfg := configDefault(config...)
// Initialize
cfg.rulesRegex = map[*regexp.Regexp]string{}
for k, v := range cfg.Rules {
k = strings.Repl... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/middleware/idempotency/response_msgp.go | middleware/idempotency/response_msgp.go | // Code generated by github.com/tinylib/msgp DO NOT EDIT.
package idempotency
import (
"github.com/tinylib/msgp/msgp"
)
// DecodeMsg implements msgp.Decodable
func (z *response) DecodeMsg(dc *msgp.Reader) (err error) {
var field []byte
_ = field
var zb0001 uint32
zb0001, err = dc.ReadMapHeader()
if err != nil ... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/middleware/idempotency/response_msgp_test.go | middleware/idempotency/response_msgp_test.go | // Code generated by github.com/tinylib/msgp DO NOT EDIT.
package idempotency
import (
"bytes"
"testing"
"github.com/tinylib/msgp/msgp"
)
func TestMarshalUnmarshalresponse(t *testing.T) {
v := response{}
bts, err := v.MarshalMsg(nil)
if err != nil {
t.Fatal(err)
}
left, err := v.UnmarshalMsg(bts)
if err ... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/middleware/idempotency/idempotency_test.go | middleware/idempotency/idempotency_test.go | package idempotency
import (
"errors"
"fmt"
"io"
"net/http"
"net/http/httptest"
"strconv"
"sync"
"sync/atomic"
"testing"
"time"
"github.com/gofiber/fiber/v3"
"github.com/valyala/fasthttp"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
const validKey = "00000000-0000-0000-... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/middleware/idempotency/response.go | middleware/idempotency/response.go | package idempotency
// response is a struct that represents the response of a request.
// generation tool `go install github.com/tinylib/msgp@latest`
//
//go:generate msgp -o=response_msgp.go -tests=true -unexported
type response struct {
Headers map[string][]string `msg:"hs"`
Body []byte `msg:"b"`
StatusCod... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/middleware/idempotency/config.go | middleware/idempotency/config.go | package idempotency
import (
"errors"
"fmt"
"time"
"github.com/gofiber/fiber/v3"
"github.com/gofiber/fiber/v3/internal/storage/memory"
)
var ErrInvalidIdempotencyKey = errors.New("invalid idempotency key")
// Config defines the config for middleware.
type Config struct {
// Lock locks an idempotency key.
//
... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/middleware/idempotency/locker.go | middleware/idempotency/locker.go | package idempotency
import (
"sync"
)
// Locker implements a spinlock for a string key.
type Locker interface {
Lock(key string) error
Unlock(key string) error
}
type countedLock struct {
mu sync.Mutex
locked int
}
// MemoryLock coordinates access to idempotency keys using in-memory locks.
type MemoryLock ... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/middleware/idempotency/stub_test.go | middleware/idempotency/stub_test.go | package idempotency
import (
"context"
"time"
)
// stubLock implements Locker for testing purposes.
type stubLock struct {
lockErr error
unlockErr error
afterLock func()
}
func (s *stubLock) Lock(string) error {
if s.afterLock != nil {
s.afterLock()
}
return s.lockErr
}
func (s *stubLock) Unlock(string) ... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/middleware/idempotency/idempotency.go | middleware/idempotency/idempotency.go | package idempotency
import (
"fmt"
"github.com/gofiber/fiber/v3"
"github.com/gofiber/fiber/v3/log"
"github.com/gofiber/utils/v2"
)
// Inspired by https://datatracker.ietf.org/doc/html/draft-ietf-httpapi-idempotency-key-header-02
// and https://github.com/penguin-statistics/backend-next/blob/f2f7d5ba54fc8a58f168d... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/middleware/idempotency/locker_test.go | middleware/idempotency/locker_test.go | package idempotency_test
import (
"strconv"
"sync/atomic"
"testing"
"time"
"github.com/gofiber/fiber/v3/middleware/idempotency"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
// go test -run Test_MemoryLock
func Test_MemoryLock(t *testing.T) {
t.Parallel()
l := idempotency.Ne... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/middleware/timeout/config.go | middleware/timeout/config.go | package timeout
import (
"time"
"github.com/gofiber/fiber/v3"
)
// Config holds the configuration for the timeout middleware.
type Config struct {
// Next defines a function to skip this middleware.
// Optional. Default: nil
Next func(c fiber.Ctx) bool
// OnTimeout is executed when a timeout occurs.
// Optio... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/middleware/timeout/timeout_test.go | middleware/timeout/timeout_test.go | package timeout
import (
"context"
"errors"
"fmt"
"net/http"
"net/http/httptest"
"testing"
"time"
"github.com/gofiber/fiber/v3"
"github.com/stretchr/testify/require"
"github.com/valyala/fasthttp"
)
var (
// Custom error that we treat like a timeout when returned by the handler.
errCustomTimeout = errors.... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/middleware/timeout/timeout.go | middleware/timeout/timeout.go | package timeout
import (
"context"
"errors"
"github.com/gofiber/fiber/v3"
)
// New enforces a timeout for each incoming request. It replaces the request's
// context with one that has the configured deadline, which is exposed through
// c.Context(). If the timeout expires or any of the specified errors occur,
// ... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/middleware/redirect/config.go | middleware/redirect/config.go | package redirect
import (
"regexp"
"github.com/gofiber/fiber/v3"
)
// Config defines the config for middleware.
type Config struct {
// Filter defines a function to skip middleware.
// Optional. Default: nil
Next func(fiber.Ctx) bool
// Rules defines the URL path rewrite rules. The values captured in asterisk... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/middleware/redirect/redirect_test.go | middleware/redirect/redirect_test.go | package redirect
import (
"context"
"net/http"
"testing"
"github.com/gofiber/fiber/v3"
"github.com/stretchr/testify/require"
)
func Test_Redirect(t *testing.T) {
app := *fiber.New()
app.Use(New(Config{
Rules: map[string]string{
"/default": "google.com",
},
StatusCode: fiber.StatusMovedPermanently,
... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/middleware/redirect/redirect.go | middleware/redirect/redirect.go | package redirect
import (
"regexp"
"strconv"
"strings"
"github.com/gofiber/fiber/v3"
"github.com/gofiber/utils/v2"
)
// New creates a new middleware handler
func New(config ...Config) fiber.Handler {
cfg := configDefault(config...)
// Initialize
cfg.rulesRegex = map[*regexp.Regexp]string{}
for k, v := rang... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/addon/retry/exponential_backoff_test.go | addon/retry/exponential_backoff_test.go | package retry
import (
"crypto/rand"
"errors"
"testing"
"time"
"github.com/stretchr/testify/require"
)
func Test_ExponentialBackoff_Retry(t *testing.T) {
t.Parallel()
tests := []struct {
expErr error
expBackoff *ExponentialBackoff
f func() error
name string
}{
{
name: "W... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/addon/retry/config.go | addon/retry/config.go | package retry
import (
"time"
)
// Config defines the config for addon.
type Config struct {
// InitialInterval defines the initial time interval for backoff algorithm.
//
// Optional. Default: 1 * time.Second
InitialInterval time.Duration
// MaxBackoffTime defines maximum time duration for backoff algorithm. ... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/addon/retry/config_test.go | addon/retry/config_test.go | package retry
import (
"testing"
"time"
"github.com/stretchr/testify/require"
)
func TestConfigDefault_NoConfig(t *testing.T) {
t.Parallel()
cfg := configDefault()
require.Equal(t, DefaultConfig, cfg)
}
func TestConfigDefault_Custom(t *testing.T) {
t.Parallel()
custom := Config{
InitialInterval: 2 * time.... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/addon/retry/exponential_backoff.go | addon/retry/exponential_backoff.go | package retry
import (
"crypto/rand"
"math/big"
"time"
)
// ExponentialBackoff is a retry mechanism for retrying some calls.
type ExponentialBackoff struct {
// InitialInterval is the initial time interval for backoff algorithm.
InitialInterval time.Duration
// MaxBackoffTime is the maximum time duration for b... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/extractors/extractors_test.go | extractors/extractors_test.go | package extractors
import (
"context"
"net/http"
"strings"
"testing"
"github.com/gofiber/fiber/v3"
"github.com/stretchr/testify/require"
"github.com/valyala/fasthttp"
)
// go test -run Test_Extractors_Missing
func Test_Extractors_Missing(t *testing.T) {
t.Parallel()
app := fiber.New()
// Add a route to te... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/extractors/extractors.go | extractors/extractors.go | package extractors
// Package extractors provides shared value extraction utilities for Fiber middleware.
// This package helps reduce code duplication across middleware packages
// while ensuring consistent behavior, security practices, and RFC compliance.
// It can extract string values from various HTTP request sou... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/binder/binder_test.go | binder/binder_test.go | package binder
import (
"mime/multipart"
"reflect"
"strconv"
"testing"
"github.com/stretchr/testify/require"
"github.com/valyala/fasthttp"
)
func Test_GetAndPutToThePool(t *testing.T) {
t.Parallel()
// Panics in case we get from another pool
require.Panics(t, func() {
_ = GetFromThePool[*HeaderBinding](&... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/binder/cbor_test.go | binder/cbor_test.go | package binder
import (
"testing"
"github.com/fxamacker/cbor/v2"
"github.com/stretchr/testify/require"
)
func Test_CBORBinder_Bind(t *testing.T) {
t.Parallel()
b := &CBORBinding{
CBORDecoder: cbor.Unmarshal,
}
require.Equal(t, "cbor", b.Name())
type Post struct {
Title string `cbor:"title"`
}
type U... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/binder/json.go | binder/json.go | package binder
import (
"github.com/gofiber/utils/v2"
)
// JSONBinding is the JSON binder for JSON request body.
type JSONBinding struct {
JSONDecoder utils.JSONUnmarshal
}
// Name returns the binding name.
func (*JSONBinding) Name() string {
return "json"
}
// Bind parses the request body as JSON and returns th... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/binder/form.go | binder/form.go | package binder
import (
"mime/multipart"
"sync"
"github.com/gofiber/utils/v2"
"github.com/valyala/fasthttp"
)
const MIMEMultipartForm string = "multipart/form-data"
var (
formMapPool = sync.Pool{
New: func() any {
return make(map[string][]string)
},
}
formFileMapPool = sync.Pool{
New: func() any {
... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/binder/xml_test.go | binder/xml_test.go | package binder
import (
"encoding/xml"
"testing"
"github.com/stretchr/testify/require"
)
func Test_XMLBinding_Bind(t *testing.T) {
t.Parallel()
b := &XMLBinding{
XMLDecoder: xml.Unmarshal,
}
require.Equal(t, "xml", b.Name())
type Posts struct {
XMLName xml.Name `xml:"post"`
Title string `xml:"tit... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/binder/cbor.go | binder/cbor.go | package binder
import (
"github.com/gofiber/utils/v2"
)
// CBORBinding is the CBOR binder for CBOR request body.
type CBORBinding struct {
CBORDecoder utils.CBORUnmarshal
}
// Name returns the binding name.
func (*CBORBinding) Name() string {
return "cbor"
}
// Bind parses the request body as CBOR and returns th... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/binder/form_test.go | binder/form_test.go | package binder
import (
"bytes"
"io"
"mime/multipart"
"testing"
"github.com/stretchr/testify/require"
"github.com/valyala/fasthttp"
)
func Test_FormBinder_Bind(t *testing.T) {
t.Parallel()
b := &FormBinding{
EnableSplitting: true,
}
require.Equal(t, "form", b.Name())
type Post struct {
Title string ... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/binder/xml.go | binder/xml.go | package binder
import (
"fmt"
"github.com/gofiber/utils/v2"
)
// XMLBinding is the XML binder for XML request body.
type XMLBinding struct {
XMLDecoder utils.XMLUnmarshal
}
// Name returns the binding name.
func (*XMLBinding) Name() string {
return "xml"
}
// Bind parses the request body as XML and returns the... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/binder/cookie_test.go | binder/cookie_test.go | package binder
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/valyala/fasthttp"
)
func Test_CookieBinder_Bind(t *testing.T) {
t.Parallel()
b := &CookieBinding{
EnableSplitting: true,
}
require.Equal(t, "cookie", b.Name())
type Post struct {
Title string `form:"title"`
}
type Us... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/binder/mapping_test.go | binder/mapping_test.go | package binder
import (
"fmt"
"mime/multipart"
"reflect"
"strconv"
"sync"
"testing"
"github.com/gofiber/schema"
"github.com/stretchr/testify/require"
)
func Test_EqualFieldType(t *testing.T) {
t.Parallel()
var out int
require.False(t, equalFieldType(&out, reflect.Int, "key", "query"))
var dummy struct{... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/binder/resp_header_test.go | binder/resp_header_test.go | package binder
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/valyala/fasthttp"
)
func Test_RespHeaderBinder_Bind(t *testing.T) {
t.Parallel()
b := &RespHeaderBinding{
EnableSplitting: true,
}
require.Equal(t, "respHeader", b.Name())
type User struct {
Name string `respHeader:"... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/binder/uri.go | binder/uri.go | package binder
// URIBinding is the binder implementation for populating values from route parameters.
type URIBinding struct{}
// Name returns the binding name.
func (*URIBinding) Name() string {
return "uri"
}
// Bind parses the URI parameters and returns the result.
func (b *URIBinding) Bind(params []string, par... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/binder/msgpack.go | binder/msgpack.go | package binder
import (
"github.com/gofiber/utils/v2"
)
// MsgPackBinding is the MsgPack binder for MsgPack request body.
type MsgPackBinding struct {
MsgPackDecoder utils.MsgPackUnmarshal
}
// Name returns the binding name.
func (*MsgPackBinding) Name() string {
return "msgpack"
}
// Bind parses the request bod... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/binder/json_test.go | binder/json_test.go | package binder
import (
"encoding/json"
"testing"
"github.com/stretchr/testify/require"
)
func Test_JSON_Binding_Bind(t *testing.T) {
t.Parallel()
b := &JSONBinding{
JSONDecoder: json.Unmarshal,
}
require.Equal(t, "json", b.Name())
type Post struct {
Title string `json:"title"`
}
type User struct {
... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/binder/query_test.go | binder/query_test.go | package binder
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/valyala/fasthttp"
)
func Test_QueryBinder_Bind(t *testing.T) {
t.Parallel()
b := &QueryBinding{
EnableSplitting: true,
}
require.Equal(t, "query", b.Name())
type Post struct {
Title string `query:"title"`
}
type User... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/binder/header.go | binder/header.go | package binder
import (
"github.com/gofiber/utils/v2"
"github.com/valyala/fasthttp"
)
// HeaderBinding is the binder implementation used to populate values from HTTP headers.
type HeaderBinding struct {
EnableSplitting bool
}
// Name returns the binding name.
func (*HeaderBinding) Name() string {
return "header"... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/binder/header_test.go | binder/header_test.go | package binder
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/valyala/fasthttp"
)
func Test_HeaderBinder_Bind(t *testing.T) {
t.Parallel()
b := &HeaderBinding{
EnableSplitting: true,
}
require.Equal(t, "header", b.Name())
type User struct {
Name string `header:"Name"`
Names [... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/binder/cookie.go | binder/cookie.go | package binder
import (
"github.com/gofiber/utils/v2"
"github.com/valyala/fasthttp"
)
// CookieBinding is the cookie binder for cookie request body.
type CookieBinding struct {
EnableSplitting bool
}
// Name returns the binding name.
func (*CookieBinding) Name() string {
return "cookie"
}
// Bind parses the req... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/binder/uri_test.go | binder/uri_test.go | package binder
import (
"testing"
"github.com/stretchr/testify/require"
)
func Test_URIBinding_Bind(t *testing.T) {
t.Parallel()
b := &URIBinding{}
require.Equal(t, "uri", b.Name())
type User struct {
Name string `uri:"name"`
Posts []string `uri:"posts"`
Age int `uri:"age"`
}
var user User
... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/binder/resp_header.go | binder/resp_header.go | package binder
import (
"github.com/gofiber/utils/v2"
"github.com/valyala/fasthttp"
)
// RespHeaderBinding is the respHeader binder for response header.
type RespHeaderBinding struct {
EnableSplitting bool
}
// Name returns the binding name.
func (*RespHeaderBinding) Name() string {
return "respHeader"
}
// Bin... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/binder/query.go | binder/query.go | package binder
import (
"github.com/gofiber/utils/v2"
"github.com/valyala/fasthttp"
)
// QueryBinding is the query binder for query request body.
type QueryBinding struct {
EnableSplitting bool
}
// Name returns the binding name.
func (*QueryBinding) Name() string {
return "query"
}
// Bind parses the request q... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/binder/mapping.go | binder/mapping.go | package binder
import (
"fmt"
"maps"
"mime/multipart"
"reflect"
"strings"
"sync"
"github.com/gofiber/utils/v2"
"github.com/valyala/bytebufferpool"
"github.com/gofiber/schema"
)
// ParserConfig form decoder config for SetParserDecoder
type ParserConfig struct {
SetAliasTag string
ParserType [... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/binder/binder.go | binder/binder.go | package binder
import (
"errors"
"sync"
)
// Binder errors
var (
ErrSuitableContentNotFound = errors.New("binder: suitable content not found to parse body")
ErrMapNotConvertible = errors.New("binder: map is not convertible to map[string]string or map[string][]string")
ErrMapNilDestination = errors.Ne... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/binder/msgpack_test.go | binder/msgpack_test.go | package binder
import (
"testing"
"github.com/shamaton/msgpack/v2"
"github.com/stretchr/testify/require"
)
func Test_Msgpack_Binding_Bind(t *testing.T) {
t.Parallel()
b := &MsgPackBinding{
MsgPackDecoder: msgpack.Unmarshal,
}
require.Equal(t, "msgpack", b.Name())
type Post struct {
Title string `msgpac... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/internal/storage/memory/memory_test.go | internal/storage/memory/memory_test.go | package memory
import (
"context"
"testing"
"time"
"github.com/stretchr/testify/require"
)
func Test_Storage_Memory_Set(t *testing.T) {
t.Parallel()
var (
testStore = New()
key = "john"
val = []byte("doe")
)
err := testStore.Set(key, val, 0)
require.NoError(t, err)
keys, err := testStor... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/internal/storage/memory/memory.go | internal/storage/memory/memory.go | // Package memory Is a copy of the storage memory from the external storage packet as a purpose to test the behavior
// in the unittests when using a storages from these packets
package memory
import (
"context"
"fmt"
"sync"
"time"
"github.com/gofiber/utils/v2"
)
// Storage provides an in-memory implementation ... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/internal/storage/memory/config.go | internal/storage/memory/config.go | package memory
import (
"time"
)
// Config defines the config for storage.
type Config struct {
// Time before deleting expired keys
//
// Default is 10 * time.Second
GCInterval time.Duration
}
// ConfigDefault is the default config
var ConfigDefault = Config{
GCInterval: 10 * time.Second,
}
// configDefault ... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/internal/memory/memory_test.go | internal/memory/memory_test.go | package memory
import (
"testing"
"time"
"github.com/gofiber/utils/v2"
"github.com/stretchr/testify/require"
)
// go test -run Test_Memory -v -race
func Test_Memory(t *testing.T) {
t.Parallel()
store := New()
var (
key = "john-internal"
val any = []byte("doe")
exp = 1 * time.Second
)
// Set k... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/internal/memory/memory.go | internal/memory/memory.go | // Package memory provides a high-performance in-memory storage that can store
// any type without encoding overhead. Unlike the standard storage interface,
// this storage works directly with Go types for maximum speed.
//
// # Safety Considerations
//
// This storage automatically performs defensive copying for:
// ... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/internal/tlstest/tls.go | internal/tlstest/tls.go | package tlstest
import (
"bytes"
"crypto/rand"
"crypto/rsa"
"crypto/tls"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
"errors"
"fmt"
"math/big"
"net"
"time"
)
var errAppendCACert = errors.New("failed to append CA certificate to certificate pool")
// GetTLSConfigs generates TLS configurations for a tes... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/client/request.go | client/request.go | package client
import (
"bytes"
"context"
"errors"
"io"
"iter"
"maps"
"path/filepath"
"reflect"
"slices"
"sort"
"strconv"
"sync"
"time"
"github.com/gofiber/fiber/v3"
"github.com/gofiber/utils/v2"
"github.com/valyala/fasthttp"
)
// WithStruct is implemented by types that allow data to be stored from a... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/client/client.go | client/client.go | // Package client exposes Fiber's HTTP client built on top of fasthttp.
//
// It allows constructing new clients or wrapping existing fasthttp transports
// so applications can share pools, dialers, and TLS settings between Fiber and
// lower-level fasthttp integrations.
package client
import (
"context"
"crypto/tls... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/client/transport_test.go | client/transport_test.go | package client
import (
"crypto/tls"
"errors"
"net"
"sync/atomic"
"testing"
"time"
"github.com/stretchr/testify/require"
"github.com/valyala/fasthttp"
)
type stubBalancingClient struct{}
func (stubBalancingClient) DoDeadline(*fasthttp.Request, *fasthttp.Response, time.Time) error {
return nil
}
func (stubB... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/client/response.go | client/response.go | package client
import (
"bytes"
"errors"
"fmt"
"io"
"io/fs"
"iter"
"os"
"path/filepath"
"sync"
"github.com/gofiber/utils/v2"
"github.com/valyala/fasthttp"
)
// Response represents the result of a request. It provides access to the response data.
type Response struct {
client *Client
request *Request
... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/client/errors.go | client/errors.go | package client
import (
"errors"
)
var (
errResponseChanTypeAssertion = errors.New("failed to type-assert to *Response")
errChanErrorTypeAssertion = errors.New("failed to type-assert to chan error")
errRequestTypeAssertion = errors.New("failed to type-assert to *Request")
errFileTypeAssertion = e... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/client/helper_test.go | client/helper_test.go | package client
import (
"net"
"testing"
"time"
"github.com/fxamacker/cbor/v2"
"github.com/gofiber/fiber/v3"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/valyala/fasthttp/fasthttputil"
)
type testServer struct {
app *fiber.App
ch chan struct{}
ln *fasthttputil.In... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/client/cookiejar_test.go | client/cookiejar_test.go | package client
import (
"bytes"
"testing"
"time"
"github.com/stretchr/testify/require"
"github.com/valyala/fasthttp"
)
func checkKeyValue(t *testing.T, cj *CookieJar, cookie *fasthttp.Cookie, uri *fasthttp.URI, n int) {
t.Helper()
cs := cj.Get(uri)
require.GreaterOrEqual(t, len(cs), n)
c := cs[n-1]
requi... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/client/client_test.go | client/client_test.go | package client
import (
"context"
"crypto/tls"
"encoding/hex"
"errors"
"io"
"net"
"os"
"path/filepath"
"reflect"
"sync"
"sync/atomic"
"testing"
"time"
"github.com/gofiber/fiber/v3"
"github.com/gofiber/fiber/v3/addon/retry"
"github.com/gofiber/fiber/v3/internal/tlstest"
"github.com/gofiber/fiber/v3/lo... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | true |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/client/request_bench_test.go | client/request_bench_test.go | package client
import (
"runtime"
"runtime/metrics"
"strconv"
"testing"
)
// BenchmarkRequestHeapScan measures how much heap memory the GC needs to scan
// when a batch of requests is created and released.
func BenchmarkRequestHeapScan(b *testing.B) {
samples := []metrics.Sample{
{Name: "/gc/scan/heap:bytes"},... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/client/hooks_test.go | client/hooks_test.go | package client
import (
"bytes"
"encoding/xml"
"fmt"
"io"
"net"
"net/url"
"path/filepath"
"strings"
"testing"
"github.com/fxamacker/cbor/v2"
"github.com/gofiber/fiber/v3"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/valyala/fasthttp"
)
func Test_Rand_String(t *... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/client/hooks.go | client/hooks.go | package client
import (
"crypto/rand"
"fmt"
"io"
"mime/multipart"
"os"
"path/filepath"
"regexp"
"strconv"
"strings"
"sync"
"github.com/gofiber/utils/v2"
"github.com/valyala/fasthttp"
)
var protocolCheck = regexp.MustCompile(`^https?://.*$`)
var fileBufPool = sync.Pool{
New: func() any {
b := make([]b... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/client/core.go | client/core.go | // Core pipeline scaffolds request execution for Fiber's HTTP client, including
// hook invocation, retry orchestration, and timeout management around fasthttp
// transports.
package client
import (
"context"
"errors"
"net"
"strconv"
"strings"
"sync"
"github.com/valyala/fasthttp"
"github.com/gofiber/fiber/v3... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/client/cookiejar.go | client/cookiejar.go | // The code was originally taken from https://github.com/valyala/fasthttp/pull/526.
package client
import (
"bytes"
"net"
"strings"
"sync"
"time"
"github.com/gofiber/utils/v2"
"github.com/valyala/fasthttp"
)
var cookieJarPool = sync.Pool{
New: func() any {
return &CookieJar{}
},
}
// AcquireCookieJar ret... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/client/core_test.go | client/core_test.go | package client
import (
"context"
"crypto/tls"
"errors"
"net"
"sync"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/valyala/fasthttp"
"github.com/valyala/fasthttp/fasthttputil"
"github.com/gofiber/fiber/v3"
)
func Test_AddMissing_Port(t *testing.T... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/client/transport.go | client/transport.go | // Transport adapters unify fasthttp clients behind a shared interface so the
// Fiber client can coordinate behavior like redirects, TLS overrides, and
// dial customizations regardless of the underlying transport type.
package client
import (
"bytes"
"crypto/tls"
"time"
"github.com/valyala/fasthttp"
)
// defau... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/client/request_test.go | client/request_test.go | package client
import (
"bytes"
"context"
"errors"
"io"
"maps"
"mime/multipart"
"net"
"os"
"path/filepath"
"regexp"
"strings"
"testing"
"time"
"github.com/gofiber/fiber/v3"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/valyala/fasthttp"
"github.com/valyala/fa... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | true |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/client/response_test.go | client/response_test.go | package client
import (
"bytes"
"crypto/tls"
"encoding/xml"
"io"
"net"
"os"
"testing"
"github.com/gofiber/fiber/v3/internal/tlstest"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/gofiber/fiber/v3"
)
func Test_Response_Status(t *testing.T) {
t.Parallel()
setupA... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/log/default.go | log/default.go | package log
import (
"context"
"fmt"
"io"
"log"
"os"
"github.com/gofiber/utils/v2"
"github.com/valyala/bytebufferpool"
)
var _ AllLogger[*log.Logger] = (*defaultLogger)(nil)
type defaultLogger struct {
stdlog *log.Logger
level Level
depth int
}
// privateLog logs a message at a given level log the defa... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/log/fiberlog.go | log/fiberlog.go | package log
import (
"context"
"io"
)
// Fatal calls the default logger's Fatal method and then os.Exit(1).
func Fatal(v ...any) {
logger.Fatal(v...)
}
// Error calls the default logger's Error method.
func Error(v ...any) {
logger.Error(v...)
}
// Warn calls the default logger's Warn method.
func Warn(v ...any... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/log/log.go | log/log.go | package log
import (
"context"
"fmt"
"io"
"log"
"os"
)
// baseLogger defines the minimal logger functionality required by the package.
// It allows storing any logger implementation regardless of its generic type.
type baseLogger interface {
CommonLogger
SetLevel(Level)
SetOutput(io.Writer)
WithContext(ctx c... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/log/fiberlog_test.go | log/fiberlog_test.go | package log
import (
"log"
"os"
"testing"
"github.com/stretchr/testify/require"
)
func Test_DefaultSystemLogger(t *testing.T) {
t.Parallel()
defaultL := DefaultLogger[*log.Logger]()
require.Equal(t, logger, defaultL)
}
func Test_SetLogger(t *testing.T) {
setLog := &defaultLogger{
stdlog: log.New(os.Stderr... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
gofiber/fiber | https://github.com/gofiber/fiber/blob/2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d/log/default_test.go | log/default_test.go | package log
import (
"bytes"
"context"
"log"
"os"
"testing"
"github.com/stretchr/testify/require"
)
const work = "work"
func initDefaultLogger() {
logger = &defaultLogger{
stdlog: log.New(os.Stderr, "", 0),
depth: 4,
}
}
type byteSliceWriter struct {
b []byte
}
func (w *byteSliceWriter) Write(p []by... | go | MIT | 2e37e61ca4a4ce0ab8e7ca72e7ea52409db55d5d | 2026-01-07T08:35:58.039181Z | false |
danielmiessler/Fabric | https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/cmd/fabric/version.go | cmd/fabric/version.go | package main
var version = "v1.4.374"
| go | MIT | d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725 | 2026-01-07T08:35:59.866090Z | false |
danielmiessler/Fabric | https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/cmd/fabric/main.go | cmd/fabric/main.go | package main
import (
"fmt"
"os"
"github.com/jessevdk/go-flags"
"github.com/danielmiessler/fabric/internal/cli"
)
func main() {
err := cli.Cli(version)
if err != nil && !flags.WroteHelp(err) {
fmt.Fprintf(os.Stderr, "%s\n", err)
os.Exit(1)
}
}
| go | MIT | d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725 | 2026-01-07T08:35:59.866090Z | false |
danielmiessler/Fabric | https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/cmd/generate_changelog/main.go | cmd/generate_changelog/main.go | package main
import (
"fmt"
"os"
"path/filepath"
"github.com/danielmiessler/fabric/cmd/generate_changelog/internal"
"github.com/danielmiessler/fabric/cmd/generate_changelog/internal/changelog"
"github.com/danielmiessler/fabric/cmd/generate_changelog/internal/config"
"github.com/danielmiessler/fabric/cmd/genera... | go | MIT | d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725 | 2026-01-07T08:35:59.866090Z | false |
danielmiessler/Fabric | https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/cmd/generate_changelog/util/token.go | cmd/generate_changelog/util/token.go | package util
import (
"os"
)
// GetTokenFromEnv returns a GitHub token based on the following precedence order:
// 1. If tokenValue is non-empty, it is returned.
// 2. Otherwise, if the GITHUB_TOKEN environment variable is set, its value is returned.
// 3. Otherwise, if the GH_TOKEN environment variable is set, i... | go | MIT | d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725 | 2026-01-07T08:35:59.866090Z | false |
danielmiessler/Fabric | https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/cmd/generate_changelog/internal/release.go | cmd/generate_changelog/internal/release.go | package internal
import (
"context"
"fmt"
"os/exec"
"regexp"
"strings"
"github.com/danielmiessler/fabric/cmd/generate_changelog/internal/cache"
"github.com/danielmiessler/fabric/cmd/generate_changelog/internal/config"
"github.com/google/go-github/v66/github"
"golang.org/x/oauth2"
)
type ReleaseManager struc... | go | MIT | d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725 | 2026-01-07T08:35:59.866090Z | false |
danielmiessler/Fabric | https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/cmd/generate_changelog/internal/cache/cache.go | cmd/generate_changelog/internal/cache/cache.go | package cache
import (
"database/sql"
"encoding/json"
"fmt"
"os"
"time"
"github.com/danielmiessler/fabric/cmd/generate_changelog/internal/git"
"github.com/danielmiessler/fabric/cmd/generate_changelog/internal/github"
_ "github.com/mattn/go-sqlite3"
)
type Cache struct {
db *sql.DB
}
func New(dbPath string)... | go | MIT | d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725 | 2026-01-07T08:35:59.866090Z | false |
danielmiessler/Fabric | https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/cmd/generate_changelog/internal/github/client.go | cmd/generate_changelog/internal/github/client.go | package github
import (
"context"
"fmt"
"net/http"
"os"
"strings"
"sync"
"time"
"github.com/google/go-github/v66/github"
"github.com/hasura/go-graphql-client"
"golang.org/x/oauth2"
)
type Client struct {
client *github.Client
graphqlClient *graphql.Client
owner string
repo strin... | go | MIT | d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725 | 2026-01-07T08:35:59.866090Z | false |
danielmiessler/Fabric | https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/cmd/generate_changelog/internal/github/types.go | cmd/generate_changelog/internal/github/types.go | package github
import "time"
type PR struct {
Number int
Title string
Body string
Author string
AuthorURL string
AuthorType string // "user", "organization", or "bot"
URL string
MergedAt time.Time
Commits []PRCommit
MergeCommit string
}
// PRDetails encapsulates all... | go | MIT | d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725 | 2026-01-07T08:35:59.866090Z | false |
danielmiessler/Fabric | https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/cmd/generate_changelog/internal/github/email_test.go | cmd/generate_changelog/internal/github/email_test.go | package github
import (
"testing"
"time"
)
func TestPRCommitEmailHandling(t *testing.T) {
tests := []struct {
name string
commit PRCommit
expected string
}{
{
name: "Valid email field",
commit: PRCommit{
SHA: "abc123",
Message: "Fix bug in authentication",
Author: "John Doe",
... | go | MIT | d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725 | 2026-01-07T08:35:59.866090Z | false |
danielmiessler/Fabric | https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/cmd/generate_changelog/internal/git/walker.go | cmd/generate_changelog/internal/git/walker.go | package git
import (
"fmt"
"os"
"os/exec"
"path/filepath"
"regexp"
"strconv"
"strings"
"time"
"github.com/danielmiessler/fabric/cmd/generate_changelog/util"
"github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/object"
"github.com/go-git/go-git/v5/plum... | go | MIT | d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725 | 2026-01-07T08:35:59.866090Z | false |
danielmiessler/Fabric | https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/cmd/generate_changelog/internal/git/types.go | cmd/generate_changelog/internal/git/types.go | package git
import (
"time"
)
type Commit struct {
SHA string
Message string
Author string
Email string
Date time.Time
IsMerge bool
PRNumber int
IsVersion bool
Version string
}
type Version struct {
Name string
Date time.Time
CommitSHA string
Commits []*Commit
PRNu... | go | MIT | d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725 | 2026-01-07T08:35:59.866090Z | false |
danielmiessler/Fabric | https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/cmd/generate_changelog/internal/config/config.go | cmd/generate_changelog/internal/config/config.go | package config
type Config struct {
RepoPath string
OutputFile string
Limit int
Version string
SaveData bool
CacheFile string
NoCache bool
RebuildCache bool
GitHubToken string
ForcePRSync bool
EnableAISummary bool
IncomingP... | go | MIT | d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725 | 2026-01-07T08:35:59.866090Z | false |
danielmiessler/Fabric | https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/cmd/generate_changelog/internal/changelog/merge_detection_test.go | cmd/generate_changelog/internal/changelog/merge_detection_test.go | package changelog
import (
"testing"
"time"
"github.com/danielmiessler/fabric/cmd/generate_changelog/internal/github"
)
func TestIsMergeCommit(t *testing.T) {
tests := []struct {
name string
commit github.PRCommit
expected bool
}{
{
name: "Regular commit with single parent",
commit: github.P... | go | MIT | d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725 | 2026-01-07T08:35:59.866090Z | false |
danielmiessler/Fabric | https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/cmd/generate_changelog/internal/changelog/processing_test.go | cmd/generate_changelog/internal/changelog/processing_test.go | package changelog
import (
"os"
"path/filepath"
"strings"
"testing"
"github.com/danielmiessler/fabric/cmd/generate_changelog/internal/config"
)
func TestDetectVersion(t *testing.T) {
tempDir := t.TempDir()
tests := []struct {
name string
versionNixContent string
expectedVersion string
... | go | MIT | d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725 | 2026-01-07T08:35:59.866090Z | false |
danielmiessler/Fabric | https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/cmd/generate_changelog/internal/changelog/generator.go | cmd/generate_changelog/internal/changelog/generator.go | package changelog
import (
"crypto/sha256"
"fmt"
"os"
"regexp"
"sort"
"strings"
"time"
"github.com/danielmiessler/fabric/cmd/generate_changelog/internal/cache"
"github.com/danielmiessler/fabric/cmd/generate_changelog/internal/config"
"github.com/danielmiessler/fabric/cmd/generate_changelog/internal/git"
"g... | go | MIT | d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725 | 2026-01-07T08:35:59.866090Z | false |
danielmiessler/Fabric | https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/cmd/generate_changelog/internal/changelog/processing.go | cmd/generate_changelog/internal/changelog/processing.go | package changelog
import (
"fmt"
"os"
"path/filepath"
"regexp"
"sort"
"strconv"
"strings"
"sync"
"time"
"github.com/danielmiessler/fabric/cmd/generate_changelog/internal/git"
"github.com/danielmiessler/fabric/cmd/generate_changelog/internal/github"
)
var (
mergePatterns []*regexp.Regexp
mergePattern... | go | MIT | d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725 | 2026-01-07T08:35:59.866090Z | false |
danielmiessler/Fabric | https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/cmd/generate_changelog/internal/changelog/summarize.go | cmd/generate_changelog/internal/changelog/summarize.go | package changelog
import (
"fmt"
"os"
"os/exec"
"strings"
)
const DefaultSummarizeModel = "claude-sonnet-4-20250514"
const MinContentLength = 256 // Minimum content length to consider for summarization
const prompt = `# ROLE
You are an expert Technical Writer specializing in creating clear, concise,
and professi... | go | MIT | d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725 | 2026-01-07T08:35:59.866090Z | false |
danielmiessler/Fabric | https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/cmd/generate_changelog/internal/changelog/generator_test.go | cmd/generate_changelog/internal/changelog/generator_test.go | package changelog
import (
"os"
"path/filepath"
"regexp"
"testing"
"github.com/danielmiessler/fabric/cmd/generate_changelog/internal/config"
)
func TestDetectVersionFromNix(t *testing.T) {
tempDir := t.TempDir()
t.Run("version.nix exists", func(t *testing.T) {
versionNixContent := `"1.2.3"`
versionNixPat... | go | MIT | d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725 | 2026-01-07T08:35:59.866090Z | false |
danielmiessler/Fabric | https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/cmd/code2context/code_test.go | cmd/code2context/code_test.go | package main
import (
"encoding/json"
"os"
"path/filepath"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestScanFiles(t *testing.T) {
// Create temp directory with test files
tmpDir := t.TempDir()
// Create test files
file1 := filepath.Join(tmpDir, "test1.go"... | go | MIT | d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725 | 2026-01-07T08:35:59.866090Z | false |
danielmiessler/Fabric | https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/cmd/code2context/code.go | cmd/code2context/code.go | package main
import (
"encoding/json"
"fmt"
"os"
"path/filepath"
"strings"
)
// FileItem represents a file in the project
type FileItem struct {
Type string `json:"type"`
Name string `json:"name"`
Content string `json:"content,omitempty"`
Contents []FileItem `json:"contents,omitempty"`
}... | go | MIT | d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725 | 2026-01-07T08:35:59.866090Z | false |
danielmiessler/Fabric | https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/cmd/code2context/main.go | cmd/code2context/main.go | package main
import (
"bufio"
"flag"
"fmt"
"os"
"strings"
)
func main() {
// Command line flags
maxDepth := flag.Int("depth", 3, "Maximum directory depth to scan")
ignorePatterns := flag.String("ignore", ".git,node_modules,vendor", "Comma-separated patterns to ignore")
outputFile := flag.String("out", "", "O... | go | MIT | d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725 | 2026-01-07T08:35:59.866090Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.