Refactor httpInterceptor.

Makes it easier to implement #5.