• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

CaptainFact / captain-fact-extension / 4601924444

pending completion
4601924444

push

github

Benjamin Piouffle
chore: Deps update + cleanup

26 of 120 branches covered (21.67%)

Branch coverage included in aggregate %.

69 of 69 new or added lines in 13 files covered. (100.0%)

59 of 228 relevant lines covered (25.88%)

0.67 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

12.5
/app/lib/http_api.js
1
import fetch from 'isomorphic-fetch'
2

3
import { CF_API_URL } from './constants'
4

5
class CaptainFactHttpApi {
6
  constructor(baseUrl) {
7
    this.baseUrl = baseUrl
1✔
8
  }
9

10
  prepareResponse(promise) {
11
    return promise.then((response) => {
×
12
      return response.text().then((body) => {
×
13
        body = body ? JSON.parse(body) : null
×
14
        if (body.errors) throw body.errors
×
15
        else return body.data
×
16
      })
17
    })
18
  }
19

20
  makeRequest(requestType, data) {
21
    const response = fetch(this.baseUrl, {
×
22
      method: requestType,
23
      body: data ? JSON.stringify(data) : '',
×
24
      headers: { 'Content-Type': 'application/json' },
25
    })
26
    return this.prepareResponse(response)
×
27
  }
28

29
  post(data) {
30
    return this.makeRequest('POST', data)
×
31
  }
32
}
33

34
// Configure HttpApi
35
const HttpApi = new CaptainFactHttpApi(CF_API_URL)
1✔
36
export default HttpApi
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc