client: Extract xhr functionality into module