downstreamcall

package
v0.0.0-...-f5c7691 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureHystrixCommand

func ConfigureHystrixCommand(hystrixCommandName string, timeoutMs int)

Configures hystrix command timeout, concurrency and error threshold

func HystrixPerformGET

func HystrixPerformGET(ctx context.Context, hystrixCommandName string, httpClient *http.Client, url string) (string, int, error)

Performs a http GET, returning the response body and status and passing on the request id if present in the context.

The request is wrapped with a hystrix circuit breaker and timeout.

Note: you must make at least one call to ConfigureHystrixCommand() before calling this.

func HystrixPerformPOST

func HystrixPerformPOST(ctx context.Context, hystrixCommandName string, httpClient *http.Client, url string, requestBody string) (string, int, error)

Performs a http POST, returning the response body and status and passing on the request id if present in the context.

The request is wrapped with a hystrix circuit breaker and timeout.

Note: you must make at least one call to ConfigureHystrixCommand() before calling this.

func HystrixPerformPUT

func HystrixPerformPUT(ctx context.Context, hystrixCommandName string, httpClient *http.Client, url string, requestBody string) (string, int, error)

Performs a http PUT, returning the response body and status and passing on the request id if present in the context.

The request is wrapped with a hystrix circuit breaker and timeout.

Note: you must make at least one call to ConfigureHystrixCommand() before calling this.

func ParseJson

func ParseJson(body string, dto interface{}) error

tip: dto := &whatever.WhateverDto{}

func PerformGET

func PerformGET(ctx context.Context, httpClient *http.Client, url string, requestBody string) (string, int, error)

performs a http GET, returning the response body and status and passing on the request id if present in the context

func PerformPOST

func PerformPOST(ctx context.Context, httpClient *http.Client, url string, requestBody string) (string, int, error)

performs a http POST, returning the response body and status and passing on the request id if present in the context

func PerformPUT

func PerformPUT(ctx context.Context, httpClient *http.Client, url string, requestBody string) (string, int, error)

performs a http PUT, returning the response body and status and passing on the request id if present in the context

func RenderJson

func RenderJson(dto interface{}) (string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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