MCPcopy Index your code
hub / github.com/Preloading/TwitterAPIBridge / SendRequest

Function SendRequest

bluesky/blueskyapi.go:405–423  ·  view source on GitHub ↗

Cache TTL of 5 minutes

(token *string, method string, url string, body io.Reader)

Source from the content-addressed store, hash-verified

403var userCache = bridge.NewCache(5 * time.Minute) // Cache TTL of 5 minutes
404
405func SendRequest(token *string, method string, url string, body io.Reader) (*http.Response, error) {
406 client := &http.Client{}
407 req, err := http.NewRequest(method, url, body)
408 if err != nil {
409 return nil, err
410 }
411 if token != nil {
412 req.Header.Set("Authorization", "Bearer "+*token)
413 }
414 req.Header.Set("Content-Type", "application/json") // 99% sure all bluesky requests are json.
415 req.Header.Set("User-Agent", "ATwitterBridge/1.0")
416
417 resp, err := client.Do(req)
418 if err != nil {
419 return nil, err
420 }
421
422 return resp, nil
423}
424
425func SendRequestWithContentType(token *string, method string, url string, body io.Reader, content_type string) (*http.Response, error) {
426 client := &http.Client{}

Callers 15

AuthenticateFunction · 0.85
RefreshTokenFunction · 0.85
GetUserInfoFunction · 0.85
GetUserInfoRawFunction · 0.85
GetUsersInfoFunction · 0.85
GetUsersInfoRawFunction · 0.85
GetRelationshipsFunction · 0.85
GetTimelineFunction · 0.85
GetHotPostsFunction · 0.85
GetUserTimelineFunction · 0.85
GetMediaTimelineFunction · 0.85
GetListTimelineFunction · 0.85

Calls 1

SetMethod · 0.45

Tested by

no test coverage detected