@@ -22,7 +22,7 @@ module.exports = async (pluginConfig, context) => {
2222 const repoId = getRepoId ( context , gitlabUrl , repositoryUrl ) ;
2323 const encodedRepoId = encodeURIComponent ( repoId ) ;
2424 const encodedGitTag = encodeURIComponent ( gitTag ) ;
25- const apiOptions = { json : true , headers : { 'PRIVATE-TOKEN' : gitlabToken } } ;
25+ const apiOptions = { headers : { 'PRIVATE-TOKEN' : gitlabToken } } ;
2626
2727 debug ( 'repoId: %o' , repoId ) ;
2828 debug ( 'release name: %o' , gitTag ) ;
@@ -56,12 +56,9 @@ module.exports = async (pluginConfig, context) => {
5656 // Uploaded assets to the project
5757 const form = new FormData ( ) ;
5858 form . append ( 'file' , createReadStream ( file ) ) ;
59- const { body} = await got . post ( urlJoin ( gitlabApiUrl , `/projects/${ encodedRepoId } /uploads` ) , {
60- ...apiOptions ,
61- json : false ,
62- body : form ,
63- } ) ;
64- const { url, alt} = JSON . parse ( body ) ;
59+ const { url, alt} = await got
60+ . post ( urlJoin ( gitlabApiUrl , `/projects/${ encodedRepoId } /uploads` ) , { ...apiOptions , body : form } )
61+ . json ( ) ;
6562
6663 assetsList . push ( { label, alt, url} ) ;
6764
@@ -73,7 +70,7 @@ module.exports = async (pluginConfig, context) => {
7370 debug ( 'Update git tag %o with commit %o and release description' , gitTag , gitHead ) ;
7471 await got . post ( urlJoin ( gitlabApiUrl , `/projects/${ encodedRepoId } /repository/tags/${ encodedGitTag } /release` ) , {
7572 ...apiOptions ,
76- body : { tag_name : gitTag , description : notes } , // eslint-disable-line camelcase
73+ json : { tag_name : gitTag , description : notes } , // eslint-disable-line camelcase
7774 } ) ;
7875
7976 if ( assetsList . length > 0 ) {
@@ -82,7 +79,7 @@ module.exports = async (pluginConfig, context) => {
8279 debug ( 'Add link to asset %o' , label || alt ) ;
8380 return got . post ( urlJoin ( gitlabApiUrl , `/projects/${ encodedRepoId } /releases/${ encodedGitTag } /assets/links` ) , {
8481 ...apiOptions ,
85- body : { name : label || alt , url : urlJoin ( gitlabUrl , repoId , url ) } ,
82+ json : { name : label || alt , url : urlJoin ( gitlabUrl , repoId , url ) } ,
8683 } ) ;
8784 } )
8885 ) ;
0 commit comments