Hi all
I have a list with following values:
[{"host", "localhost:4000"}, {"connection", "keep-alive"},
{"pragma", "no-cache"}, {"cache-control", "no-cache"},
{"accept", "application/xml"}, {"sap-contextid-accept", "header"},
{"accept-language", "en-US"}, {"maxdataserviceversion", "3.0"},
{"user-agent",
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36"},
{"referer", "http://localhost:4000/ui5"},
{"accept-encoding", "gzip, deflate, sdch, br"}]
and I want to convert it to keyword list and tried as follow:
iex(4)> Enum.reduce(test, [], fn ({key, value},acc) -> [key: value] ++ acc end)
[key: "gzip, deflate, sdch, br", key: "http://localhost:4000/ui5",
key: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
key: "3.0", key: "en-US", key: "header", key: "application/xml",
key: "no-cache", key: "no-cache", key: "keep-alive", key: "localhost:4000"]
Key should be a binary not Key.
How can I solve the problem?
Thanks






















