File size: 559 Bytes
6fefda3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package utils

import (
	"crypto/tls"
	"fmt"
	"github.com/go-resty/resty/v2"
	"time"
)

var (
	RestySSEClient = resty.New().
		SetTimeout(1 * time.Minute).
		SetTLSClientConfig(&tls.Config{InsecureSkipVerify: true}).
		SetDoNotParseResponse(true).
		SetHeaders(map[string]string{
			"Content-Type": "application/json",
		}).
		OnAfterResponse(func(c *resty.Client, resp *resty.Response) error {
			if resp.StatusCode() != 200 {
				return fmt.Errorf("Jetbrains API error: status %d, body: %s",
					resp.StatusCode(), resp.String())
			}
			return nil
		})
)