Home / File/ gin_integration_test.go — gin Source File

gin_integration_test.go — gin Source File

Architecture documentation for gin_integration_test.go, a go file in the gin codebase. 1 imports, 0 dependents.

File go GinCore Context 1 imports 20 functions 2 classes

Entity Profile

Dependency Diagram

graph LR
  076d326a_acfa_c808_1141_d1324fc6e43a["gin_integration_test.go"]
  4d187a4e_b459_c18d_d79b_e367af9eb3b7["bufio"]
  076d326a_acfa_c808_1141_d1324fc6e43a --> 4d187a4e_b459_c18d_d79b_e367af9eb3b7
  style 076d326a_acfa_c808_1141_d1324fc6e43a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

// Copyright 2017 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 (
	"bufio"
	"crypto/tls"
	"fmt"
	"html/template"
	"io"
	"net"
	"net/http"
	"net/http/httptest"
	"os"
	"path/filepath"
	"runtime"
	"strings"
	"sync"
	"testing"
	"time"

	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
)

// params[0]=url example:http://127.0.0.1:8080/index (cannot be empty)
// params[1]=response status (custom compare status) default:"200 OK"
// params[2]=response body (custom compare content)  default:"it worked"
func testRequest(t *testing.T, params ...string) {
	if len(params) == 0 {
		t.Fatal("url cannot be empty")
	}

	tr := &http.Transport{
		TLSClientConfig: &tls.Config{
			InsecureSkipVerify: true,
		},
	}
	client := &http.Client{Transport: tr}

	resp, err := client.Get(params[0])
	require.NoError(t, err)
	defer resp.Body.Close()

	body, ioerr := io.ReadAll(resp.Body)
	require.NoError(t, ioerr)

	responseStatus := "200 OK"
	if len(params) > 1 && params[1] != "" {
		responseStatus = params[1]
	}

	responseBody := "it worked"
	if len(params) > 2 && params[2] != "" {
		responseBody = params[2]
	}

	assert.Equal(t, responseStatus, resp.Status, "should get a "+responseStatus)
// ... (548 more lines)

Domain

Subdomains

Dependencies

  • bufio

Frequently Asked Questions

What does gin_integration_test.go do?
gin_integration_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 gin_integration_test.go?
gin_integration_test.go defines 20 function(s): TestBadFileDescriptor, TestBadListener, TestBadTrustedCIDRs, TestBadUnixSocket, TestConcurrentHandleContext, TestEscapedColon, TestFileDescriptor, TestListener, TestPusher, TestRunEmpty, and 10 more.
What does gin_integration_test.go depend on?
gin_integration_test.go imports 1 module(s): bufio.
Where is gin_integration_test.go in the architecture?
gin_integration_test.go is located at gin_integration_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