status-im / nim-presto

REST API framework for Nim language
MIT License
55 stars 10 forks source link

importing presto/client reveals that presto is missing the encodeBytes proc #26

Open monyarm opened 2 years ago

monyarm commented 2 years ago
/home/monyarm/.nimble/pkgs/presto-0.0.4/presto/client.nim(808, 21) Error: undeclared identifier: 'encodeBytes'
candidates (edit distance, scope distance); see '--spellSuggest': 
 (4, 10): 'getBodyBytes' [proc declared in /home/monyarm/.nimble/pkgs/chronos-#asyncproc/chronos/apps/http/httpclient.nim(1145, 6)]
 (4, 10): 'getBodyBytes' [proc declared in /home/monyarm/.nimble/pkgs/chronos-#asyncproc/chronos/apps/http/httpclient.nim(1169, 6)]

presto uses the proc, but doesn't define it outside of tests/helpers

mratsim commented 2 years ago

encodeBytes is an application-defined proc. You need to write it yourself for the types you use.

I do agree that this should be mentioned in the README

See for example: https://github.com/status-im/nimbus-eth2/blob/039bece9175104b5c87a8c2ff6b1eafae731b05e/beacon_chain/spec/eth2_apis/eth2_rest_serialization.nim#L1906-L1942=