How to use axios-curlirize - 4 common examples

To help you get started, we’ve selected a few axios-curlirize examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github JDIS / flaggr / frontend / user / src / main.ts View on Github external
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './plugins/buefy'
import i18n from './plugins/i18n'
import axios, { AxiosRequestConfig } from 'axios'
// @ts-ignore
import curlirize from 'axios-curlirize'

if (process.env.VUE_APP_DEBUG) {
  curlirize(axios)
}

axios.interceptors.request.use((config) => {
  // This appends the backend url after each call, allowing to use it
  // like that: axios.get('status') instead of axios.get(`${process.env.VUE_APP_BACKEND_URL}/status`)
  config.baseURL = `${process.env.VUE_APP_BACKEND_URL}/`;
  const configPlus: any | AxiosRequestConfig = config;
  if (configPlus.data && configPlus.data.withEvent) {
    delete config.data.withEvent
    config.baseURL += `event/${router.currentRoute.params.eventId}/`
  }
  if (process.env.VUE_APP_DEBUG) {
    configPlus.headers.Authorization = `Basic ${(store as any).getters['participant/creds']}`
  }

  store.dispatch('network/addRequestInProgress')
github JDIS / flaggr / frontend / admin / src / main.ts View on Github external
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './plugins/buefy'
import i18n from './plugins/i18n'
import axios from 'axios'
// @ts-ignore
import curlirize from 'axios-curlirize'

if (process.env.VUE_APP_DEBUG === '1') {
  curlirize(axios)
}

axios.interceptors.request.use((config: any) => {
  // This appends the backend url after each call, allowing to use it
  // like that: axios.get('status') instead of axios.get(`${process.env.VUE_APP_BACKEND_URL}/status`)
  config.url = `${process.env.VUE_APP_BACKEND_URL}/${config.url}`
  if (process.env.VUE_APP_DEBUG === '1') {
    config.headers.Authorization = `Basic ${(store as any).getters['admin/creds']}`
  }

  store.dispatch('network/addRequestInProgress')

  return config;
});

axios.interceptors.response.use((config: any) => {
github ProgressiveMass / legislator-scorecard / processData / downloadAndBuildData / downloadGoogleSheets.js View on Github external
const fs = require('fs-extra')
const axios = require('axios')
const curlirize = require('axios-curlirize').default

// get some nice debugging output
// curlirize(axios)

require('dotenv').config()

const googleSheetIds = {
  2017: '15AgxGT87Qc02IqPV46Uc0u9Z_ChfAjZQaj3qS2VNF8g',
  2019: '17SfLTsqLaoBG8WE5vKHmBY_J6Iz1IFKThm_wAqsHZdg',
}

const requestSheet = async (id, sheet) => {
  try {
    const response = await axios.get(
      `https://sheets.googleapis.com/v4/spreadsheets/${id}/values/${sheet}?key=${
        process.env.GOOGLE_API_KEY
github DefinitelyTyped / DefinitelyTyped / types / axios-curlirize / axios-curlirize-tests.ts View on Github external
import curlirize from 'axios-curlirize';
import axios from 'axios';

const Axios = axios.create({});
curlirize(Axios);
curlirize(Axios, (res, _err) => {
    const { command: string } = res;
});

axios-curlirize

Axios third-party module to print all axios requests as curl commands in the console. This repository is forked from axios-curlirize <https://www.npmjs.com/package/axios-curlirize> and supports use with Node JS without having to enable ES6 imports. This r

MIT
Latest version published 3 years ago

Package Health Score

56 / 100
Full package analysis

Popular axios-curlirize functions