func()

in request_builder.go [32:51]


func (b *httpRequestBuilder) build(
	ctx context.Context,
	method string,
	projectID string,
	endpointID string,
	urlSuffix string,
	request any,
) (*http.Request, error) {
	url := fmt.Sprintf(predictURLTemplate, projectID, endpointID) + urlSuffix

	if request == nil {
		return http.NewRequestWithContext(ctx, method, url, nil)
	}

	reqBytes, err := json.Marshal(request)
	if err != nil {
		return nil, err
	}
	return http.NewRequestWithContext(ctx, method, url, bytes.NewBuffer(reqBytes))
}