httptool

package
v1.7.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package httptool provides utilities for http request

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TryReadErrorResponse

func TryReadErrorResponse(data []byte) (string, bool)

TryReadErrorResponse tries to convert response body to an error message.

Types

type CarbonBlackAccessInfo

type CarbonBlackAccessInfo struct {
	// contains filtered or unexported fields
}

CarbonBlackAccessInfo contains the api id and api key for Carbon Black.

func (CarbonBlackAccessInfo) GetToken

func (c CarbonBlackAccessInfo) GetToken() string

GetToken generates auth token from api key & id, A normal Carbon Black Access Token will be in the format of '<api-key>/<api-id>'.

type RequestSession

type RequestSession struct {
	// contains filtered or unexported fields
}

RequestSession is the session used for sending request.

func NewRequestSession

func NewRequestSession(apiID, apiKey string) *RequestSession

NewRequestSession creates a new request session.

func (RequestSession) RequestData

func (r RequestSession) RequestData(method, url string, payload interface{}) (int, []byte, error)

RequestData will request data via method to url with payload.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL