Uniqueness of continuous extension from $A$ to $\overline{A}$ for maps into a Hausdorff space

I want to prove the following.

Let $A$ be a subset of $X$. Let $f:A \to Y$ be continuous. Let $Y$ be Hausdorff. Show that if $f$ can be extended to a continuous function $g:\overline{A}\to Y$, then $g$ is uniquely determined by $f$.

Assume the contrary.$g_{1}$, and $g_{2}$ are the extended $f$. Consider $B=\lbrace x\in\bar{A}\vert g_{1}=g_{2}\rbrace$ which is a subset of $\bar{A}$. Note $g_{1}$ and $g_{2}$ agrees on A due to the restriction mapping. So $A$ is a subset of $B$. Since $g_{1}$ and $g_{2}$ are continous on $\bar{A}$, we have that $B$ is closed. $B$ being closed implies that $B$ contains all of its limit points and it also include those limit points of $A$. So $B=\bar{A}$.

Why I did not use the Hausdorff condition? This seems very wrong to me. I see that Hausdorff may be necessary to argue that $B$ being closed by that it is a point set. How do I see B being a point set?

Solutions Collecting From Web of "Uniqueness of continuous extension from $A$ to $\overline{A}$ for maps into a Hausdorff space"

Using Hausdorff to show $B$ is closed:
$Y$ is a Hausdorff space then the set $D=\{(y,y)\in Y\times Y\ ,\ y\in Y\}$ is closed in $Y\times Y$. Now let $h:\overline{A}\to Y\times Y$ the map defined by $h(x)=(g_1(x),g_2(x))$ it is a continuous map, and $B=h^{-1}(D)$ is closed.

if $A$ is already closed then there is nothing to prove. so we may suppose that there is a point $a$ in the boundary of $A$ such that $g_1(a) = b_1$ and $g_2(a)=b_2$ where $b_1$ and $b_2$ are distinct points.

since $Y$ is Hausdorff we may choose disjoint open neighbourhoods $V_1$ and $V_2$ of $b_1$ and $b_2$. and we must have:
$$
a \in U = g_1^{-1}(V_1) \cap g_2^{-1}(V_2)
$$
since $a \in \partial A$ there must be a point $a^* \in A \cap U$

consider $g(a^*)$…

note that a simple counter-example shows the necessity of the Hausdorff condition for Y. take Y to be a two-point space on the set $S=\{x,y\}$ with topology specified by the open sets: $\emptyset, S, \{x\}$

let $A$ be $\mathbb{C}$ with the origin removed. can you see how to construct the counter-=example?