context_test.go — gin Source File
Architecture documentation for context_test.go, a go file in the gin codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR ebe0ae48_a62b_a38f_5bac_5bbbd96fc508["context_test.go"] fefe783b_8987_7aed_66c9_b2860bfc32e7["bytes"] ebe0ae48_a62b_a38f_5bac_5bbbd96fc508 --> fefe783b_8987_7aed_66c9_b2860bfc32e7 style ebe0ae48_a62b_a38f_5bac_5bbbd96fc508 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
// Copyright 2014 Manu Martinez-Almeida. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package gin
import (
"bytes"
"context"
"errors"
"fmt"
"html/template"
"io"
"io/fs"
"mime/multipart"
"net"
"net/http"
"net/http/httptest"
"net/url"
"os"
"path/filepath"
"reflect"
"strconv"
"strings"
"sync"
"testing"
"time"
"github.com/gin-contrib/sse"
"github.com/gin-gonic/gin/binding"
"github.com/gin-gonic/gin/codec/json"
testdata "github.com/gin-gonic/gin/testdata/protoexample"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.mongodb.org/mongo-driver/bson"
"google.golang.org/protobuf/proto"
)
var _ context.Context = (*Context)(nil)
var errTestRender = errors.New("TestRender")
// Unit tests TODO
// func (c *Context) File(filepath string) {
// func (c *Context) Negotiate(code int, config Negotiate) {
// BAD case: func (c *Context) Render(code int, render render.Render, obj ...any) {
// test that information is not leaked when reusing Contexts (using the Pool)
func createMultipartRequest() *http.Request {
boundary := "--testboundary"
body := new(bytes.Buffer)
mw := multipart.NewWriter(body)
defer mw.Close()
must(mw.SetBoundary(boundary))
must(mw.WriteField("foo", "bar"))
must(mw.WriteField("bar", "10"))
must(mw.WriteField("bar", "foo2"))
must(mw.WriteField("array", "first"))
must(mw.WriteField("array", "second"))
// ... (3695 more lines)
Domain
Subdomains
Functions
- BenchmarkGetMapFromFormData()
- CreateTestResponseRecorder()
- TestContextAbortWithError()
- TestContextAbortWithStatus()
- TestContextAbortWithStatusJSON()
- TestContextAbortWithStatusPureJSON()
- TestContextAddParam()
- TestContextAutoBindJSON()
- TestContextAutoShouldBindJSON()
- TestContextBadAutoBind()
- TestContextBadAutoShouldBind()
- TestContextBindHeader()
- TestContextBindPlain()
- TestContextBindRequestTooLarge()
- TestContextBindWithJSON()
- TestContextBindWithQuery()
- TestContextBindWithTOML()
- TestContextBindWithXML()
- TestContextBindWithYAML()
- TestContextBodyAllowedForStatus()
- TestContextClientIP()
- TestContextClientIPWithMultipleHeaders()
- TestContextClientIPWithSingleHeader()
- TestContextContentType()
- TestContextCopy()
- TestContextCopyShouldNotCancel()
- TestContextDefaultQueryOnEmptyRequest()
- TestContextError()
- TestContextFile()
- TestContextFormFile()
- TestContextFormFileFailed()
- TestContextGetCookie()
- TestContextGetDuration()
- TestContextGetError()
- TestContextGetErrorSlice()
- TestContextGetFloat32()
- TestContextGetFloat32Slice()
- TestContextGetFloat64()
- TestContextGetFloat64Slice()
- TestContextGetInt()
- TestContextGetInt16()
- TestContextGetInt16Slice()
- TestContextGetInt32()
- TestContextGetInt32Slice()
- TestContextGetInt64()
- TestContextGetInt64Slice()
- TestContextGetInt8()
- TestContextGetInt8Slice()
- TestContextGetIntSlice()
- TestContextGetRawData()
- TestContextGetString()
- TestContextGetStringMap()
- TestContextGetStringMapString()
- TestContextGetStringMapStringSlice()
- TestContextGetStringSlice()
- TestContextGetTime()
- TestContextGetUint()
- TestContextGetUint16()
- TestContextGetUint16Slice()
- TestContextGetUint32()
- TestContextGetUint32Slice()
- TestContextGetUint64()
- TestContextGetUint64Slice()
- TestContextGetUint8()
- TestContextGetUint8Slice()
- TestContextGetUintSlice()
- TestContextGolangContext()
- TestContextHandler()
- TestContextHandlerName()
- TestContextHandlerNames()
- TestContextHandlers()
- TestContextHeaders()
- TestContextInitQueryCache()
- TestContextIsAborted()
- TestContextMultipartForm()
- TestContextNegotiationFormat()
- TestContextNegotiationFormat2()
- TestContextNegotiationFormatCustom()
- TestContextNegotiationFormatWithAccept()
- TestContextNegotiationFormatWithWildcardAccept()
- TestContextNegotiationNotSupport()
- TestContextNegotiationWithBSON()
- TestContextNegotiationWithHTML()
- TestContextNegotiationWithJSON()
- TestContextNegotiationWithPROTOBUF()
- TestContextNegotiationWithTOML()
- TestContextNegotiationWithXML()
- TestContextNegotiationWithYAML()
- TestContextNext()
- TestContextPostFormMultipart()
- TestContextQuery()
- TestContextQueryAndPostForm()
- TestContextRenderAPIJSON()
- TestContextRenderAndEscapeAttachment()
- TestContextRenderAttachment()
- TestContextRenderData()
- TestContextRenderDataFromReader()
- TestContextRenderDataFromReaderNoHeaders()
- TestContextRenderFile()
- TestContextRenderFileFromFS()
- TestContextRenderHTML()
- TestContextRenderHTML2()
- TestContextRenderHTMLString()
- TestContextRenderIfErr()
- TestContextRenderIndentedJSON()
- TestContextRenderJSON()
- TestContextRenderJSONP()
- TestContextRenderJSONPWithoutCallback()
- TestContextRenderNoContentAPIJSON()
- TestContextRenderNoContentAsciiJSON()
- TestContextRenderNoContentData()
- TestContextRenderNoContentHTML()
- TestContextRenderNoContentHTMLString()
- TestContextRenderNoContentIndentedJSON()
- TestContextRenderNoContentJSON()
- TestContextRenderNoContentSecureJSON()
- TestContextRenderNoContentString()
- TestContextRenderNoContentXML()
- TestContextRenderProtoBuf()
- TestContextRenderPureJSON()
- TestContextRenderRedirectAll()
- TestContextRenderRedirectWith201()
- TestContextRenderRedirectWithAbsolutePath()
- TestContextRenderRedirectWithRelativePath()
- TestContextRenderSSE()
- TestContextRenderSecureJSON()
- TestContextRenderString()
- TestContextRenderTOML()
- TestContextRenderUTF8Attachment()
- TestContextRenderXML()
- TestContextRenderYAML()
- TestContextReset()
- TestContextResetInHandler()
- TestContextSetCookie()
- TestContextSetCookieData()
- TestContextSetCookiePathEmpty()
- TestContextSetGet()
- TestContextSetGetAnyKey()
- TestContextSetGetBool()
- TestContextSetGetPanicsWhenKeyNotComparable()
- TestContextSetGetValues()
- TestContextShouldBindBodyWith()
- TestContextShouldBindBodyWithJSON()
- TestContextShouldBindBodyWithPlain()
- TestContextShouldBindBodyWithTOML()
- TestContextShouldBindBodyWithXML()
- TestContextShouldBindBodyWithYAML()
- TestContextShouldBindHeader()
- TestContextShouldBindPlain()
- TestContextShouldBindWithJSON()
- TestContextShouldBindWithQuery()
- TestContextShouldBindWithTOML()
- TestContextShouldBindWithXML()
- TestContextShouldBindWithYAML()
- TestContextStream()
- TestContextStreamWithClientGone()
- TestContextTypedError()
- TestContextWithFallbackDeadlineFromRequestContext()
- TestContextWithFallbackDoneFromRequestContext()
- TestContextWithFallbackErrFromRequestContext()
- TestContextWithFallbackValueFromRequestContext()
- TestContextWithKeysMutex()
- TestCreateTestContextWithRouteParams()
- TestGetMapFromFormData()
- TestGetRequestHeaderValue()
- TestHasRequestContext()
- TestInterceptedHeader()
- TestRaceParamsContextCopy()
- TestRemoteIPFail()
- TestSaveUploadedCreateFailed()
- TestSaveUploadedFileWithPermission()
- TestSaveUploadedFileWithPermissionFailed()
- TestSaveUploadedOpenFailed()
- TestSetGetDelete()
- TestWebsocketsRequired()
- createMultipartRequest()
- handlerNameTest()
- handlerNameTest2()
- must()
- resetContextForClientIPTests()
Types
Dependencies
- bytes
Source
Frequently Asked Questions
What does context_test.go do?
context_test.go is a source file in the gin codebase, written in go. It belongs to the GinCore domain, Context subdomain.
What functions are defined in context_test.go?
context_test.go defines 180 function(s): BenchmarkGetMapFromFormData, CreateTestResponseRecorder, TestContextAbortWithError, TestContextAbortWithStatus, TestContextAbortWithStatusJSON, TestContextAbortWithStatusPureJSON, TestContextAddParam, TestContextAutoBindJSON, TestContextAutoShouldBindJSON, TestContextBadAutoBind, and 170 more.
What does context_test.go depend on?
context_test.go imports 1 module(s): bytes.
Where is context_test.go in the architecture?
context_test.go is located at context_test.go (domain: GinCore, subdomain: Context).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free