I want to calculate the integral $\int \sqrt{1+\sin x}\, dx$.
I have done the following:
\begin{equation*}\int \sqrt{1+\sin x}\, dx=\int \sqrt{\frac{(1+\sin x)(1-\sin x)}{1-\sin x}}\, dx=\int \sqrt{\frac{1-\sin^2 x}{1-\sin x}}\, dx=\int \sqrt{\frac{\cos^2x}{1-\sin x}}\, dx=\int \frac{\cos x}{\sqrt{1-\sin x}}\, dx\end{equation*}
We substitute $$u=\sqrt{1-\sin x} \Rightarrow du=\frac{1}{2\sqrt{1-\sin x}}\cdot (1-\sin x)'\, dx \Rightarrow du=-\frac{\cos x}{2\sqrt{1-\sin x}}\, dx \\ \Rightarrow -2\, du=\frac{\cos x}{\sqrt{1-\sin x}}\, dx $$
We get the following: \begin{equation*}\int \frac{\cos x}{\sqrt{1-\sin x}}\, dx=\int(-2)\, du=-2\cdot \int 1\, du=-2u+c\end{equation*}
Therefore \begin{equation*}\int \frac{\cos x}{\sqrt{1-\sin x}}\, dx=-2\sqrt{1-\sin x}+c\end{equation*}
In Wolfram the answer is a different one. What have I done wrong?

Rewrite the given integral using trigonometric/hyperbolic substitutions :
$$\int \sqrt{1+\sin x} dx ={\displaystyle\int}\sqrt{2}\cos\left(\dfrac{2x-{\pi}}{4}\right)\,\mathrm{d}x$$
Apply the substitution :
$$u=\dfrac{2x-{\pi}}{4} \to dx = 2du$$
which means the integral becomes equal to :
$$=\class{steps-node}{\cssId{steps-node-1}{2^\frac{3}{2}}}{\displaystyle\int}\cos\left(u\right)\,\mathrm{d}u =2^\frac{3}{2}\sin\left(u\right)$$
Undo now the substitution for $u$ and get :
$$=2^\frac{3}{2}\sin\left(\dfrac{2x-{\pi}}{4}\right)$$
which means that :
$$\int \sqrt{1+\sin x} dx =2^\frac{3}{2}\sin\left(\dfrac{2x-{\pi}}{4}\right) + C =2\sin\left(\dfrac{x}{2}\right)-2\cos\left(\dfrac{x}{2}\right)+C$$