Giter Site home page Giter Site logo

Comments (8)

texttechne avatar texttechne commented on June 18, 2024

Hi @p-mathias,
query params belong to the responsibility of the used HTTP client.
I would imagine that you're using the JqueryHttpClient as it is about SAP.

For axios and fetch there are options readily available which can be set on a global level when intializing the HTTP client.
Axios example:

new AxiosHttpClient({params: {"sap-client": "200"})

I'm astonished to see that it's not that easy regarding jQuery. It looks like you can use the prefilter option for that use case. Then along these lines:

$.ajaxPrefilter(function( options ) {
    options.url = options.url + "?sap-client=200";
  }
});

Probably you would need to do a bit more logic here => when querying, then you need to check if the "?" becomes a "&"...

I'll ponder a bit, if this can be easily built-into the jqueryHttpClient.

If you have any suggestions regarding improvements of the docs in this respect...

from odata2ts.

p-mathias avatar p-mathias commented on June 18, 2024

Well jquery is fare away from being in scope for me,
atm i try my luck with fetch api,
but doesn't got working solution done.

from odata2ts.

texttechne avatar texttechne commented on June 18, 2024

Hi p-mathias,
ah ok, so this is also missing in the fetch client.
I'll add this option to both clients then as constructor param (see Axios example).

from odata2ts.

texttechne avatar texttechne commented on June 18, 2024

Hi @p-mathias,

I've added appropriate options for the fetch and jquery http client.
For fetch it would like:

new FetchClient({params: {"sap-client": "200"}}); // actually doesn't matter if you use "200" or 200 as number

Released with @odata2ts/http-client-fetch version 0.5.0.

Please try it out and close this issue if it works.

from odata2ts.

p-mathias avatar p-mathias commented on June 18, 2024

okay i will do it
mention repo: https://github.com/odata2ts/http-client

from odata2ts.

p-mathias avatar p-mathias commented on June 18, 2024

0.5 doesn't got released so i can't test this: https://www.npmjs.com/package/@odata2ts/http-client-fetch

from odata2ts.

texttechne avatar texttechne commented on June 18, 2024

WTF?! You're right, I've just released those versions.
Sorry for the inconvenience...

from odata2ts.

p-mathias avatar p-mathias commented on June 18, 2024

works fine

from odata2ts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.