3

I wrote this code to fetch some data using the JS SDK (a third-party library) :

directus.items('configuration').read<TConfiguration>({ single: true });

This will generate a get query to

/items/configuration/?single=true

which returns an 404 Not Found error.

The right end point is without a slash '/' :

/items/configuration?single=true

I checked the documentation and I didn't find a way to remove this extra slash. And I don't want to use Apache or htaccess to ignore it.

Is there a native Directus option to remove it ?

EDIT 1 : It seems this is a bug in the library itself. The slash is hard coded there and maybe the only way to ignore it is to use htaccess.

Zied Hf
  • 491
  • 3
  • 10
  • 30
  • I hope this answer would help you a lot:- https://stackoverflow.com/a/9823754/3607051 – Raksha Saini Jan 12 '21 at 03:54
  • @RakshaSaini I think you didn't understand the question. The problem is in a third-party library. So here we should either use htaccess or apache. But I want to use a native way to remove. – Zied Hf Jan 12 '21 at 03:58
  • Ok it means you got the slash when you check the url or print it? There is some validation on third party. please check it. – Raksha Saini Jan 12 '21 at 04:00
  • @RakshaSaini Please take a look on how the JS SDK library work for Directus https://docs.directus.io/reference/sdk-js.html – Zied Hf Jan 12 '21 at 04:06
  • Ok @Zied Hf. I will check it. – Raksha Saini Jan 12 '21 at 04:09

1 Answers1

-1

I guess it's hard coded in the library.

The code is from @directus/sdk-js

enter image description here

Zied Hf
  • 491
  • 3
  • 10
  • 30