Closed eskimor closed 7 years ago
(ignore that -- I was using the wrong version of the program in the example project :sweat_smile:)
I am experiencing problems with a QueryParam:
QueryParam "file" FilePath :> Get '[JSON] Int
gives
getMovieGet :: forall eff m.
(MonadReader (SPSettings_ SPParams_) m, MonadError AjaxError m, MonadAff ( ajax :: AJAX | eff) m)
=> String -> m Int
getMovieGet file = do
spOpts_' <- ask
let spOpts_ = case spOpts_' of SPSettings_ o -> o
let spParams_ = case spOpts_.params of SPParams_ ps_ -> ps_
let baseURL = spParams_.baseURL
let httpMethod = "GET"
let reqUrl = baseURL <> "movie" <> "/" <> "get"
<> "?" <> encodeQuery "file" file
let reqHeaders =
[]
affResp <- liftAff $ affjax defaultRequest
{ method = httpMethod
, url = reqUrl
, headers = defaultRequest.headers <> reqHeaders
}
getResult decodeJson affResp
but encodeQuery
is invalid:
$ pulp build
* Building project in /home/user/src/app/app-client-web/frontend
Compiling ServerAPI
Error found:
in module ServerAPI
at /home/user/src/app/app-client-web/frontend/src/ServerAPI.purs line 114, column 16 - line 115, column 42
Unknown value encodeQuery
See https://github.com/purescript/purescript/wiki/Error-Code-UnknownName for more information,
or to contribute content related to this error.
* ERROR: Subcommand terminated with exit code 1
Thank you - I'll have a look!
Which version of servant-purescript are you using?
$ stack list-dependencies | grep servant-purescript
servant-purescript 0.6.0.0
This is really strange - the said function does not exist in servant-purescript-0.6.0.0. Anyway I am currently sick and on a tight schedule (where it really does not help being sick), so if anyone can have a look at this, it would be really much appreciated, otherwise I hope to find some time soon.
OK, I found it: I had changed the name of my executable in my .cabal file, and was still using "stack exec -- old-executable-name"... Sorry about that!
nop!
Generated code might not even compile or not work - if you experience any issues with query parameters - please report them -I'll fix them asap.