Verified Commit 7d55da2f authored by Camil Staps's avatar Camil Staps 🙂

Fix URL for toHTTPRequest; added parseSingleLineRequest as mentioned in #2

parent a7664097
......@@ -243,6 +243,8 @@ instance < Result
instance == FunctionKind
parseSingleLineRequest :: String -> MaybeErrorString Request
toHTTPRequest :: Request -> HTTPRequest
request :: Request *World -> *(MaybeErrorString Response, *World)
......@@ -10,7 +10,7 @@ import Data.Functor
import Data.Map
import Data.Tuple
import Internet.HTTP
from Text import class Text(join), instance Text String, instance + String
from Text import class Text(join,split,trim), instance Text String, instance + String
import Text.Encodings.UrlEncoding
import Text.JSON
......@@ -85,6 +85,13 @@ where
instance == FunctionKind where == a b = a === b
parseSingleLineRequest :: String -> MaybeErrorString Request
parseSingleLineRequest s = case split "::" s of
["",type] -> Ok {zero & unify=Just $ trim type}
[name,type] -> Ok {zero & name=Just $ trim name, unify=Just $ trim type}
[name] -> Ok {zero & name=Just $ trim name }
_ -> Error "Multiple ::s found"
toHTTPRequest :: Request -> HTTPRequest
toHTTPRequest req =
{ newHTTPRequest
......@@ -92,7 +99,7 @@ toHTTPRequest req =
, req_path = "/api.php"
, req_query = "?" + urlEncodePairs params
, req_headers = put "User-Agent" "Clean/libcloogle" newMap
, server_name = "local.cloogle.org"
, server_name = "cloogle.org"
}
where
params = catMaybes
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment