This repository was archived by the owner on Feb 19, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +12
-7
lines changed Expand file tree Collapse file tree 5 files changed +12
-7
lines changed Original file line number Diff line number Diff line change 2
2
'use strict' ;
3
3
4
4
var optionsValidation = Joi . object ( {
5
- endpoint : Joi . string ( ) . min ( 1 ) . optional ( ) . example ( 'https://codacy.com/coverage/:token/:commitId ' )
5
+ endpoint : Joi . string ( ) . min ( 1 ) . optional ( ) . example ( 'https://codacy.com/api/2.0/ coverage/:commitId/:language ' )
6
6
} ) ;
7
7
var tokenValidation = Joi . string ( ) . required ( ) . min ( 1 ) . example ( '1234567890' ) ; //TODO: Revisit this validation to see if we can better validate the values
8
8
var commitIdValidation = Joi . string ( ) . required ( ) . min ( 1 ) . example ( '1234567890' ) ; //TODO: Revisit this validation to see if we can better validate the values
26
26
throw optionsValid . error ;
27
27
}
28
28
29
- var endpoint = options . endpoint || 'https://www.codacy.com/api/coverage/:token/: commitId' ;
29
+ var endpoint = options . endpoint || 'https://www.codacy.com/api/2.0/ coverage/:commitId/javascript ' ;
30
30
logger . debug ( 'Setting up reporter communicating to: ' + endpoint ) ;
31
31
32
32
return {
45
45
return reject ( validationErr ) ;
46
46
}
47
47
48
- var url = endpoint . replace ( ':token' , token ) . replace ( ': commitId', commitId ) ;
48
+ var url = endpoint . replace ( ':commitId' , commitId ) ;
49
49
logger . trace ( util . format ( 'Sending POST to %s' , url ) ) ;
50
50
51
51
return request ( {
52
52
url : url ,
53
53
method : 'POST' ,
54
54
json : data ,
55
+ headers : {
56
+ // jscs:disable
57
+ 'project_token' : token
58
+ // jscs:enable
59
+ } ,
55
60
resolveWithFullResponse : true
56
61
} ) . then ( function ( res ) {
57
62
if ( res . statusCode !== 200 ) {
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " codacy-coverage" ,
3
- "version" : " 1.1.1 " ,
3
+ "version" : " 1.1.2 " ,
4
4
"description" : " Code Coverage reporter for Codacy.com" ,
5
5
"keywords" : [
6
6
" codacy" ,
Original file line number Diff line number Diff line change 40
40
return helper . setupMockEndpoint ( '1234' , '4321' , bodyValidator )
41
41
. then ( function ( ) {
42
42
return expect ( request ( {
43
- url : 'https://www.codacy.com/api/coverage/1234/ 4321' ,
43
+ url : 'https://www.codacy.com/api/2.0/ coverage/4321/javascript ' ,
44
44
method : 'POST' ,
45
45
json : sampleCoverageData ,
46
46
resolveWithFullResponse : true
Original file line number Diff line number Diff line change 17
17
expect ( bodyValidator ) . to . be . ok ( ) ;
18
18
19
19
return resolve ( nock ( 'https://www.codacy.com' )
20
- . post ( '/api/coverage/' + token + '/' + commitId , function ( body ) {
20
+ . post ( '/api/2.0/ coverage/' + commitId + '/javascript' , function ( body ) {
21
21
var result = bodyValidator . validate ( body ) ;
22
22
return result . error ? false : true ;
23
23
} )
Original file line number Diff line number Diff line change 39
39
return helper . setupMockEndpoint ( '1234' , '4321' , bodyValidator )
40
40
. then ( function ( ) {
41
41
return expect ( request ( {
42
- url : 'https://www.codacy.com/api/coverage/1234/ 4321' ,
42
+ url : 'https://www.codacy.com/api/2.0/ coverage/4321/javascript ' ,
43
43
method : 'POST' ,
44
44
json : sampleCoverageData ,
45
45
resolveWithFullResponse : true
You can’t perform that action at this time.
0 commit comments