mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00
update c/{buildah,common,image,storage} to latest main
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
14
vendor/github.com/go-openapi/runtime/request.go
generated
vendored
14
vendor/github.com/go-openapi/runtime/request.go
generated
vendored
@ -16,6 +16,8 @@ package runtime
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
@ -96,10 +98,16 @@ func (p *peekingReader) Read(d []byte) (int, error) {
|
||||
if p == nil {
|
||||
return 0, io.EOF
|
||||
}
|
||||
if p.underlying == nil {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
return p.underlying.Read(d)
|
||||
}
|
||||
|
||||
func (p *peekingReader) Close() error {
|
||||
if p.underlying == nil {
|
||||
return errors.New("reader already closed")
|
||||
}
|
||||
p.underlying = nil
|
||||
if p.orig != nil {
|
||||
return p.orig.Close()
|
||||
@ -107,9 +115,11 @@ func (p *peekingReader) Close() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// JSONRequest creates a new http request with json headers set
|
||||
// JSONRequest creates a new http request with json headers set.
|
||||
//
|
||||
// It uses context.Background.
|
||||
func JSONRequest(method, urlStr string, body io.Reader) (*http.Request, error) {
|
||||
req, err := http.NewRequest(method, urlStr, body)
|
||||
req, err := http.NewRequestWithContext(context.Background(), method, urlStr, body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user