Fix #14503: Cast to string before setting XHR header. Close gh-1427.