Skip to content

Commit

Permalink
♻️ chore(unirest): replace unirest client library by node-fetch (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
vvatelot authored May 31, 2022
1 parent 0070e6a commit 8014ed7
Show file tree
Hide file tree
Showing 666 changed files with 12,985 additions and 113,050 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: RapidAPI OpenAPI
uses: vvatelot/rapidapi-openapi-github-action@v1.1.0
uses: vvatelot/rapidapi-openapi-github-action@v1.2.0
with:
rapidapi-api-key: ${{ secrets.RAPIDAPI_API_KEY }}
rapidapi-api-id: ${{ secrets.RAPIDAPI_API_ID }}
Expand Down
35 changes: 22 additions & 13 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const core = require("@actions/core");
const unirest = require("unirest");
const editJsonFile = require("edit-json-file");
const FormData = require("form-data");
const fs = require("fs");
const axios = require("axios");

try {
const rapidApiUrl =
Expand All @@ -17,17 +19,24 @@ try {
console.log(file.toObject());
}

unirest
.put(rapidApiUrl)
.header("X-RapidAPI-Key", core.getInput("rapidapi-api-key"))
.header({ "Content-Type": "multipart/form-data" })
.attach("file", fileName)
.end(function (result) {
if (result.error) {
core.setFailed(result.error);
}
console.log(result.status, result.headers, result.body);
});
const data = new FormData();
data.append("file", fs.createReadStream(fileName));

const options = {
method: 'PUT',
url: rapidApiUrl,
headers: {
'X-RapidAPI-Key': core.getInput("rapidapi-key"),
...data.getHeaders()
},
data: data
};

axios.request(options).then(function (response) {
console.log(response);
}).catch(function (error) {
core.setFailed(error.message);
})
} catch (error) {
core.setFailed(error.message);
}
}
1 change: 0 additions & 1 deletion node_modules/.bin/mime

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/sshpk-conv

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/sshpk-sign

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/sshpk-verify

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/uuid

This file was deleted.

20 changes: 0 additions & 20 deletions node_modules/ajv/.tonic_example.js

This file was deleted.

22 changes: 0 additions & 22 deletions node_modules/ajv/LICENSE

This file was deleted.

1,497 changes: 0 additions & 1,497 deletions node_modules/ajv/README.md

This file was deleted.

7,189 changes: 0 additions & 7,189 deletions node_modules/ajv/dist/ajv.bundle.js

This file was deleted.

3 changes: 0 additions & 3 deletions node_modules/ajv/dist/ajv.min.js

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/ajv/dist/ajv.min.js.map

This file was deleted.

Loading

0 comments on commit 8014ed7

Please sign in to comment.