mapbox / mapbox-sdk-js

A JavaScript client to Mapbox services, supporting Node, browsers, and React Native
Other
718 stars 186 forks source link

Feat Request: Allow more control over response type #407

Open atomicpages opened 3 years ago

atomicpages commented 3 years ago

When fetching data from static image, it might be nice to give users more control over the response type. For example:

import mbClient from "@mapbox/mapbox-sdk";
import StaticImage from "@mapbox/mapbox-sdk/services/static";

const client = mbClient({accessToken: "..."});
const staticImageService = StaticImage(client);

staticImageService.getStaticImage({ ... })
  .send({ responseType: 'blob' })
  .then(res => {
    // do something with res
  });

I poked around the code and didn't find any way to override the response type. I'm happy to send a PR for this. LMK 👍

pedrofsantoscom commented 3 years ago

@andrewharvey Can you check this PR to fix this issue? https://github.com/mapbox/mapbox-sdk-js/pull/420 cc @atomicpages