This may be a good question for the new woodworking forum, since it is furniture related.
What you have there is good enough to support a small playhouse or shed, definitely good for mattresses and occupants.
Your main concern will be the side to side stresses, the fastening of the posts to the sides, and what it would take to make a "quiet" joint. I am certain you will not want to glue this joint since bed frames are made to be taken apart for moving purposes. Table legs are fastened in a way to allow the joints to draw tight. Following their example with a variation for added support would work as long as the joint stayed tight.
The variation would be a rabbet joint on the opposite faces. In other words, you would take out what you show being left as a stub for connection, my suggestion is to remove that 2"x1" on each side of the inside corner, leaving the faces intact on the outside. This would allow the bed rails to rest on the legs. It would not take a very deep notch, about and inch in would do it. It would change the look a bit too.
I will add a sketch later...
If you could get into mortise and tenon joints, I could elaborate more. what you have here is a strong simple joint, that could still be done as a rabbet joint, just done so it makes an inside corner, not an outside corner as your drawing shows. By the way, nice sketch.