MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / exchange

Method exchange

pkg/interop/client.go:149–174  ·  view source on GitHub ↗
(
	ctx context.Context, pathFunc func(jsRPCPaths) string, pld, res any,
)

Source from the content-addressed store, hash-verified

147}
148
149func (cl joinServerHTTPClient) exchange(
150 ctx context.Context, pathFunc func(jsRPCPaths) string, pld, res any,
151) error {
152 client, err := cl.clientProvider.HTTPClient(ctx, cl.clientOpts...)
153 if err != nil {
154 return err
155 }
156 scheme := cl.scheme
157 if scheme == "" {
158 scheme = "https"
159 }
160 if scheme != "https" {
161 log.FromContext(ctx).WithField("scheme", scheme).Warn("Use non-https scheme for contacting interop Join Server")
162 }
163 port := cl.port
164 if port == 0 {
165 port = defaultHTTPSPort
166 }
167 req, err := newHTTPRequest(
168 serverURL(scheme, cl.fqdn, pathFunc(cl.paths), port), pld, cl.headers, cl.username, cl.password,
169 )
170 if err != nil {
171 return err
172 }
173 return httpExchange(ctx, req.WithContext(ctx), res, client.Do)
174}
175
176func parseResult(r Result) error {
177 if r.ResultCode == ResultSuccess {

Callers 2

GetAppSKeyMethod · 0.95
HandleJoinRequestMethod · 0.95

Calls 7

FromContextFunction · 0.92
newHTTPRequestFunction · 0.85
serverURLFunction · 0.85
httpExchangeFunction · 0.85
HTTPClientMethod · 0.65
WarnMethod · 0.65
WithFieldMethod · 0.65

Tested by

no test coverage detected