1

Quite simular to that question I'd like to mock a PNG-Response with axios-mock-adapter.

What I tried yet:

import axios from 'axios'
import MockAdapter from 'axios-mock-adapter'
const fs = require('fs')
new MockAdapter(axios).onGet('dynamic.png').reply(200, fs.readFileSync(__dirname + '/mock.png'))

And another try:

// [...]
const bitmap = fs.readFileSync(__dirname + '/mock.png')
new MockAdapter(axios).onGet('dynamic.png').reply(200, new Buffer(bitmap).toString('base64'))

Any solution out there?

user470370
  • 572
  • 1
  • 5
  • 17

0 Answers0