Giter Club home page Giter Club logo

Comments (20)

adamint avatar adamint commented on September 27, 2024 1

ah okay, I completely missed that addition. I'm rewriting the tests to be - you know - not kiddy tests, so I'll look through them and add them to the util tests.

from spotify-web-api-kotlin.

molikuner avatar molikuner commented on September 27, 2024

having this problem:
Cannot set a request body for HTTP method DELETE

how did you solved it?

from spotify-web-api-kotlin.

adamint avatar adamint commented on September 27, 2024

I honestly don’t think I ever ran into that issue simply because I never completed an endpoint with an option body in DELETE. I’ll look into it

from spotify-web-api-kotlin.

molikuner avatar molikuner commented on September 27, 2024

I looked into it. It's a problem of jsoup. It isn't permitted to do http DELETE requests with a request body.
I didn't tested :

URL(apiEndpoint).openConnection()

yet, which would use the basic http request api of Java. Maybe I'll rewrite the execute/request function to use it instead of jsoup.
Would that be okay?

from spotify-web-api-kotlin.

adamint avatar adamint commented on September 27, 2024

To be frank, I'd prefer to use an existing HTTP library like OkHttp if we have to change how requests are made. Thoughts?

from spotify-web-api-kotlin.

molikuner avatar molikuner commented on September 27, 2024

I've never worked with OkHttp before, but it's worth a try. I'll present my results from testing. Today I don't have so much time, so maybe tomorrow.

from spotify-web-api-kotlin.

molikuner avatar molikuner commented on September 27, 2024

Now it's working, but to keep dependencies low it would be good to also replace the other functions. I couldn't get the refresh_token function to work. I pushed my code as command. Basicly OkHttp doesn't allow the x-www-form-urlencoded MediaType because it doesn't fit a MutlipartBody. Spotify gives a 415 when using the wrong MediaType. Do you know any way to do such a request with OkHttp?

from spotify-web-api-kotlin.

adamint avatar adamint commented on September 27, 2024

Now it's working, but to keep dependencies low it would be good to also replace the other functions. I couldn't get the refresh_token function to work. I pushed my code as command. Basicly OkHttp doesn't allow the x-www-form-urlencoded MediaType because it doesn't fit a MutlipartBody. Spotify gives a 415 when using the wrong MediaType. Do you know any way to do such a request with OkHttp?

I do not, unfortunately. I can look into it in the next few days. If you have time @molikuner, feel free to as well

from spotify-web-api-kotlin.

adamint avatar adamint commented on September 27, 2024

@molikuner do you still have interest in doing this?

from spotify-web-api-kotlin.

molikuner avatar molikuner commented on September 27, 2024

@adamint yes, hadn't time yet to look into it but I'm interested. Do you have a solution?

from spotify-web-api-kotlin.

adamint avatar adamint commented on September 27, 2024

Now that I have time to work on the api, I think simply creating a wrapper around Http request is the best sution. I'll add to your existing changes later today or tomorrow.

from spotify-web-api-kotlin.

molikuner avatar molikuner commented on September 27, 2024

The usage of the new Until functions to create URIs need to be reviewed. I thought it would be good to be able to pass a URI instead of the ID and the API should handle it. But I added it sometimes without testing and it isn't added consistently.

from spotify-web-api-kotlin.

adamint avatar adamint commented on September 27, 2024

What do you mean by the Until functions? I'm just a little confused by what you mean.

from spotify-web-api-kotlin.

molikuner avatar molikuner commented on September 27, 2024

those extension functions
They can be used to be sure the ID is an ID in the request or that the URI is an URI in the request.

from spotify-web-api-kotlin.

adamint avatar adamint commented on September 27, 2024

I've been doing major refractoring inside the dev branch. If you'd like, you can checkout that branch and help port your changes over. Otherwise, I can do it in a few hours. I hope to focus more on test-driven development during this rewrite, so if you do, tests are a must.

Next, I have to retroactively add tests for nearly all the existing functions, which will take a while. After that (or if you want, you can get a head start on it), I'll be wrapping HttpsURLConnection. I feel like the extra size isn't worth writing an extra 50 or so lines of code.

from spotify-web-api-kotlin.

adamint avatar adamint commented on September 27, 2024

Hopefully I'll get this done (finally)

from spotify-web-api-kotlin.

adamint avatar adamint commented on September 27, 2024

Ok.. so if I query the endpoint (same parameters) using Postman, it works. This must be a Jsoup issue

from spotify-web-api-kotlin.

molikuner avatar molikuner commented on September 27, 2024

Yes indeed. I searched a little bit.
Jsoup defines there request methods with a attribute if they can have a body. They check it before requesting. Actually by viewing the code now, I do not understand why there isn't an exception thrown, but anyways this is probably the answer why the endpoint always return with an error.

from spotify-web-api-kotlin.

adamint avatar adamint commented on September 27, 2024

Yeah I saw that. Pretty sure it’s because we ignore http errors

from spotify-web-api-kotlin.

adamint avatar adamint commented on September 27, 2024

I'm like 80% sure this works as intended but I never finished writing tests. Oops

from spotify-web-api-kotlin.

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.