Question: Linear spline set constant endpoints

I have a set of points. I want to make a linear spline of that points and plot the resulting function:

function:=CurveFitting[Spline](points_x,points_y,x,degree=1):

However I need the function to define constant y endpoint values where x is out of points_x range (i.e. first-derivation is zero where x is out of points_x range). Endpoint options does not work for me.

             constant1   x < xmin
function :=  ..
             constant2   otherwise

How can I define spline function like this?

Please Wait...