Comments (8)
Ok, I will split up the functions a little more
from elm-jwt.
have you tried
emptyDecoder : Json.Decoder String
emptyDecoder =
Json.succeed "true"
If that does not work, then you have to build your request object yourself. For example
let
req = createRequest method token url body (Json.succeed "")
req_ = { req | expect = Http.expectString }
...
from elm-jwt.
Thanks for the response @simonh1000
Json.succeed "true"
doesn't work, can you prove the full example for building a request object? What needs to be in the in
part of the let
block?
from elm-jwt.
See https://github.com/simonh1000/elm-jwt/blob/master/src/Jwt.elm#L190 and use expectText instead
from elm-jwt.
I'm having the same issue for DELETE
requests where the response obviously has no body.
from elm-jwt.
See https://github.com/simonh1000/elm-jwt/blob/master/examples/phoenix/web/elm/App.elm#L323 for example of how I would now tackle this issue with the 5.0.0 release of elm-jwt
from elm-jwt.
I'm not 100% percent sure, but I think using (Json.succeed "")
will not work. Before the decoder is even applied to the response, JSON.parse()
is called because the expectJson
part is still hardcoded in the request creation method. But the JSON parsing will fail for an empty response. I think the solution would be not to assume that the response contains any kind of JSON and remove the expectJson
from the function.
from elm-jwt.
I'm going to remove the expectJson as this is a library for accessing an authenticated REST API. But the change I published yesterday makes it quite possible to change the expect to something else.
from elm-jwt.
Related Issues (17)
- JWT uses base64url encoding, not base64 encoding HOT 5
- Request.withCredentials is not set to true HOT 4
- Examples included under elm-stuff/ HOT 4
- Examples not working HOT 3
- Tests? HOT 1
- 0.19 HOT 1
- Support elm/http 2.0.0 HOT 5
- please provide a documented, generic alias to `firebase` HOT 1
- variant of expiry check helpers that exposes remaining time? HOT 1
- move elm-jwt from relying on the truqu/elm-base64 to the danfishgold/base64-bytes
- Discussion: provide functions for split JWT token headers HOT 1
- Link to examples is broken HOT 1
- Node example App.elm is broken HOT 1
- Feature request: minimal json-server example HOT 3
- How are we supposed to include csrf headers? HOT 2
- Using package with Elm inside a Phoenix app HOT 2
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 elm-jwt.