Curl Axios对gitlab管道API的请求
在上面的文档中,您可以找到这段代码(Curl Axios对gitlab管道API的请求,curl,gitlab,axios,Curl,Gitlab,Axios,在上面的文档中,您可以找到这段代码(curl-request): 如果要将令牌作为GET参数发送,则应在标头中发送它。 试试这个: axios.get( url, {headers: { "PRIVATE-TOKEN" : "token" } } ) .then((response) => { //do something } ); export const getPipelines = () =&g
curl-request
):
如果要将令牌作为GET参数发送,则应在标头中发送它。 试试这个:
axios.get(
url,
{headers: {
"PRIVATE-TOKEN" : "token"
}
}
)
.then((response) => {
//do something
}
);
export const getPipelines = () => {
return () => {
return axios
.get(
`${URL}/api/v4/projects/${PROJECT_ID_VALUE}/pipelines?PRIVATE-TOKEN=${PERSONAL_ACCESS_TOKEN_VALUE}`
)
.then(data => data)
}
}
axios.get(
url,
{headers: {
"PRIVATE-TOKEN" : "token"
}
}
)
.then((response) => {
//do something
}
);