MCPcopy Index your code
hub / github.com/writefreely/writefreely / register

Method register

oauth.go:427–448  ·  view source on GitHub ↗
(ctx context.Context, state string)

Source from the content-addressed store, hash-verified

425}
426
427func (r *callbackProxyClient) register(ctx context.Context, state string) error {
428 form := url.Values{}
429 form.Add("state", state)
430 form.Add("location", r.callbackLocation)
431 req, err := http.NewRequestWithContext(ctx, "POST", r.server, strings.NewReader(form.Encode()))
432 if err != nil {
433 return err
434 }
435 req.Header.Set("User-Agent", ServerUserAgent(""))
436 req.Header.Set("Accept", "application/json")
437 req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
438
439 resp, err := r.httpClient.Do(req)
440 if err != nil {
441 return err
442 }
443 if resp.StatusCode != http.StatusCreated {
444 return fmt.Errorf("unable register state location: %d", resp.StatusCode)
445 }
446
447 return nil
448}
449
450func limitedJsonUnmarshal(body io.ReadCloser, n int, thing interface{}) error {
451 lr := io.LimitReader(body, int64(n+1))

Callers 8

viewOauthInitMethod · 0.80
iFunction · 0.80
HFunction · 0.80
tex-svg-full.jsFile · 0.80
lFunction · 0.80
PQFunction · 0.80
NQFunction · 0.80
BQFunction · 0.80

Calls 2

ServerUserAgentFunction · 0.85
DoMethod · 0.65

Tested by

no test coverage detected