In Bayesian analysis, suppose the posterior distribution is given by $$ P(\theta|x)=\begin{cases} p_1(\theta|x) & ; & 0<\theta<1 \\ p_2(\theta|x) & ; & \theta>1 \\ \end{cases}. $$ There are several possible configurations of $p_1$ and $p_2$. For exemplo, $p_1(0)=\infty$ and decreasing, $p_2(1)=c$ then decreasing as $\theta\to\infty$.
I was wondering, how to obtain the HPD interval in this situation? Note that to obtain it, we should find the $\theta$'s such that $P(\theta|x)=k$, if $\theta_1$ and $\theta_2$ are such values, $\theta_1$ and $\theta_2$ must satisfy $P(\theta_1<\theta<\theta_2|x)=0.95$, for example. I am not sure how to do it. Thanks in advance.