is `onresponse` actually shared anywhere? seems like its only used here. might be nicer to just inline it in that case, like `onend` is