Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Axios Target #176

Merged
merged 4 commits into from Aug 16, 2020
Merged

Add Axios Target #176

merged 4 commits into from Aug 16, 2020

Conversation

rohit-gohri
Copy link
Contributor

@rohit-gohri rohit-gohri commented Aug 11, 2020

Closes #155

Added for both node (require/commonjs syntax) and javascript (import/esm syntax)
I haven't tested the multipart form-data part so if anyone could confirm that is working that'd be great.

Axios Docs: https://github.com/axios/axios

Example Output:
node_axios target

var axios = require("axios").default;

var options = {
  method: 'POST',
  url: 'https://example.com/api/item/1000',
  headers: {'content-type': 'application/json', 'api-key': 'REPLACE_KEY_VALUE'},
  data: {status: 'INACTIVE'}
};

axios.request(options).then(function (response) {
  console.log(response.data);
}).catch(function (error) {
  console.error(error);
});

javascript_axios target

import axios from "axios";

const options = {
  method: 'POST',
  url: 'https://example.com/api/item/1000',
  headers: {'content-type': 'application/json', 'api-key': 'REPLACE_KEY_VALUE'},
  data: {status: 'INACTIVE'}
};

axios.request(options).then(function (response) {
  console.log(response.data);
}).catch(function (error) {
  console.error(error);
});

@rohit-gohri rohit-gohri marked this pull request as draft August 11, 2020 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Axios conversion
2 participants