-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The README is not enough documentation to actually start using this library #1031
Comments
I generally avoid putting imports into code blocks in READMEs. They are the first lines of the block but the least important and therefore distract more than they help. If we need some more viable samples then I'd suggest to either have a separate Maven module which just contains executable sample code. That way anyone can look at proper Java code (w/ imports) and we can actually check that it's correct by executing it as part of our test suite.
Apart from the dependencies declared in the respective POMs, what are you missing exactly?
Like the following paragraphs? https://github.com/zalando/riptide/blob/main/docs/concepts.md#route
Can you specify what you expect some "higher-level way" would look like?
Either you treat the header like a response and capture it so that you can use it later (i.e. |
I agree for imports of types where the type name is unique enough. For static imports of method names, where unaware people (like me) have no way of knowing in which class to look, it is needed. (Alternatively, include the class name for the method calls instead of using static imports.)
I'm fine with that too (if it can be found from the README).
I'm not sure what was missing in my case, that's the point. There are many projects, and I don't know which ones I need for my simple use case.
Something like this, yes. I somehow missed this document (or this part of the document).
I somehow thought that I pass a lambda which will get the header as a parameter, not that I need to dig through the ClientHttpResponse object myself. But this was before I understood that a Route is just a fancy
Thanks, I'll try that. When I'm done I might propose some concrete additions to the README. |
Description
There seems to be some information missing in the README to actually use the library.
Expected Behavior
Reading the README (or some other documentation linked from there) should be enough to actually start using the library, i.e. sending out HTTP requests and doing something with the response.
Actual Behavior
I've read the README (and several of the other documents linked from there), and still have no clue on what exactly to do.
Reading the source of some of the classes helped somewhat, but not fully.
Possible Fix
Context
I remembered from some presentations at work (at Zalando) that "Riptide" is the new way of doing HTTP requests (and getting responses) nowadays. I got a (private) problem where I want to automate filling a form to book an appointment, for which I need some HTTP requests (and handling the responses), so I said "let's try this out".
Steps to Reproduce
Being on vacation, I don't have any access to production code which is using Riptide (from which I could copy this), and I also didn't find any example code in this repository.
I'm just looking at the README (and everything which is linked from there).
The first step in my project was
I've set up an
Http
object using the riptide-spring-boot-starter.Looking at the Requests section, sending the request seems easy:
Now handling the response ...
This short section with one conceptual paragraph, and one piece of example code seems to be all there is on documentation for what is supposed the main feature of Riptide. And the example code doesn't even work when copying it, because all the imports are missing (specifically, the static imports for
on
,series()
,contentType()
,status()
,anyStatus()
and the Spring HTTP status code and series enum values).(It also references user code, but I can understand this.)
With some browsing through the classes in riptide-core, I found that I need those imports (I guess
*
imports would also work):... or possibly one of the
.call(...)
in the last line?After some more digging I found that I can just implement my own Route, or rather a
ThrowingConsumer<ClientHttpResponse>
which will just fetch the header from the response itself.I still have the suspicion that there is some higher-level way of doing this, though, which I didn't find yet.
I didn't yet get to the next step of actually using this location header for making the next request, and then extracting data from the response to that request.
(Actually running this (with a debugger) shows that the Apache HTTP client which is used here already takes care of the redirect internally, so I guess this all was just wasted effort.)
Your Environment
The text was updated successfully, but these errors were encountered: