github.com/blend/go-sdk@v1.20220411.3/r2/opt_url.go (about) 1 /* 2 3 Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved 4 Use of this source code is governed by a MIT license that can be found in the LICENSE file. 5 6 */ 7 8 package r2 9 10 import ( 11 "net/url" 12 13 "github.com/blend/go-sdk/ex" 14 ) 15 16 // OptURL sets the url of a request. 17 func OptURL(rawURL string) Option { 18 return func(r *Request) error { 19 if r.Request == nil { 20 return ex.New(ErrRequestUnset) 21 } 22 var err error 23 r.Request.URL, err = url.Parse(rawURL) 24 return ex.New(err) 25 } 26 }