gitlab.com/jfprevost/gitlab-runner-notlscheck@v11.11.4+incompatible/network/patch_response.go (about) 1 package network 2 3 import ( 4 "net/http" 5 "strconv" 6 "strings" 7 ) 8 9 type TracePatchResponse struct { 10 *RemoteJobStateResponse 11 12 RemoteRange string 13 } 14 15 func (p *TracePatchResponse) NewOffset() int { 16 remoteRangeParts := strings.Split(p.RemoteRange, "-") 17 if len(remoteRangeParts) == 2 { 18 newOffset, _ := strconv.Atoi(remoteRangeParts[1]) 19 return newOffset 20 } 21 22 return 0 23 } 24 25 func NewTracePatchResponse(response *http.Response) *TracePatchResponse { 26 return &TracePatchResponse{ 27 RemoteJobStateResponse: NewRemoteJobStateResponse(response), 28 RemoteRange: response.Header.Get("Range"), 29 } 30 }