Comments (3)
Thanks for the question, at some point I hope to work on docs, this will definitely end up there :)
from sttp.
If I understand correctly, you can do something similar by defining a partial request which contains a pre-defined set of cookies. E.g.:
val loginRequest = sttp.post(uri"https://secret.com?login=admin&pass=admin")
// assuming a synchronous backend is available
val loginResponse: Response[String] = loginRequest.send()
// this copies the cookies from the response to the partial request
val authenticatedRequest = sttp.cookies(loginResponse)
// now authenticatedRequest is an empty request with only the cookies sent back by the login post
// it can be used multiple times to run many requests, e.g.:
authenticatedRequest.get(uri"https://secret.com/vault").send()
authenticatedRequest.post(uri"https://secret.com/update").send()
from sttp.
Thanks @adamw.
from sttp.
Related Issues (20)
- No way to handle Invalid header value using HttpClientZioBackend HOT 1
- 415 / UnsupportedMediaType but generated curl works HOT 1
- Consideration for Release of sttp Version 3.8.15 With Updated Dependencies Of FS2 and http4s-client For CE 3.5.0 HOT 4
- Ignore content-encoding header if it is empty
- Create a body serialiser for JSON AST types HOT 1
- Extend Slf4jLoggingBackend so that it allows markers to be added to logs HOT 2
- Compilation error for Curl backend on Scala Native HOT 1
- Add a native Cats Effect backend
- application/json content type shouldn't have the charset specified
- URI interpolator does not enforce scheme HOT 2
- Request body gzip compression HOT 2
- Add Pekko to "Supported backends"
- HTTP connection stuck on tcp state CLOSE_WAIT, Cats-effect backend HOT 5
- JS artifact for ZIO module is incomplete HOT 3
- Add default structured logging ? HOT 6
- [Feature Request] Add a configurable download size limit to clients
- Non-breaking structured logging implementation HOT 2
- Default multipart form encoding uses noncompliant URLEncoder for tilde (~) HOT 2
- Empty body sent when using Http4sBackend with circe JSON body with JdkHttpClient
- AsyncHttpClientBackend ignores onlyProxyHosts
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sttp.