mapbox / mapbox/mapbox-sdk-js

Feat Request: Allow more control over response type

Open
#407 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
768
Forks
191
PR merge metrics
No merged PRs in 30d

Description

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 👍

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the static image service's getStaticImage entry point and the request handling behind send(). Trace how response types are currently selected, then check the surrounding service behavior before making a change. Done means callers can pass responseType, including 'blob', and receive the requested response type.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.