Skip to content
This repository was archived by the owner on May 6, 2026. It is now read-only.
This repository was archived by the owner on May 6, 2026. It is now read-only.

simple configuration causes weird doubletting og req params #14

Description

@klh
const actions = {

  // url only
  users: 'users',

  // url and param only
  user: 'users?id=:id',

  // url and object
  create: {
    method: 'post',
    url: 'users',
    headers: { 'Content-Type': 'application/json' }
  },

  // url and param only
  update: {
    method: 'put',
    url: 'users/:id/',
    headers: { 'Content-Type': 'application/json' }
  },

  // url and param only
  delete: {
    method: 'delete',
    url: 'users/:id/',
    headers: { 'Content-Type': 'application/json' }
  },

  // method and url
  getMethodUrl: 'GET users/:id',

  // request object
  getObject: {
    method: 'get',
    url: 'users/:id/',
    headers: { 'X-Custom-Header': 'foobar' }
  }
};

Jest test:

  it(' users getObject', async () => {
    const response = await users.getObject({"id":2});
    expect(response.data)
      .toMatchSpecificSnapshot('./__snapshots__/endpoints_user_search.shot');
  });

results in a get request to the endpoint like this:

/v1/users/2/?id=2

where it in reality should be:

/v1/users/2/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions