# Calculating Residue with NIntegrate fails

Trying to answer this interesting question Principal value from two different axis I observed a problem using `Nintegrate`:

The function `func[p_] := 1/(Sinh[p/2] Sqrt[Cosh[p]])` has a pol at `p==0`.

The residue of this point evaluates to

``Residue[func[z], {z, 0}] (*2*) Limit[func[z] z, z -> 0] (*2*) ``

The result might be confirmed by integrating along a path in the complex plane which contains the pol. For example integrating along a square path

``NIntegrate[func[z], {z, 1, I, -1, -I, 1}]/(2 Pi I) (*2*) ``

evaluates correct value , whereas integrating along a circle

``NIntegrate[func[ Exp[I \[CurlyPhi] ]]/(2 Pi I), {\[CurlyPhi], 0, 2 Pi}]  (*~0*) ``

gives a message `NIntegrate failed to converge... ` and a wrong result `0`!

What’s wrong with this last integration?

How to modify to get the correct result?

Thanks!