In this video (minute 5:20), they prove that $$ I = \int_{-\infty}^{\infty}e^{i x^2}dx = e^{i\frac{\pi}{4}}\sqrt{\pi}$$ by deforming the integration contour in the complex plane from the real axis to a straight line crossing the origin at a $\frac{\pi}{4}$ angle. In other words, they perform the change of variable $ x = e^{i\frac{\pi}{4}}t$, and change the integration measure accordingly, i.e., $dx = e^{i \frac{\pi}{4}}dt$. Then, they claim that $$ I = e^{i\frac{\pi}{4}}\int_{-\infty}^{\infty}e^{-x^2}dx,$$ where the resulting integral is a well known result. I don't distrust the result (in fact, it's proven in this other question), but I'm concerned about the change of variable. Why didn't they change the bounds of the integral to $\pm(1+i)\infty$? Is it always possible to proceed as they did?
P.S. The video is part of an online course on complex analysis by the MISiS
