Fix POST handler to detect truncated input