refactor encoders and decoders.
add fetch request/response codec.