Pass the encoder function to HttpRequest on initialisation (and similarly for decoder and HttpResponse)