Congress is sending legislation to President Barack Obama that would head off the threat of a government shutdown at midnight Wednesday.

Democrats helped embattled House GOP leaders pass the measure by a sweeping 277-151 vote with just hours to spare. The Senate passed the legislation by a 78-20 tally earlier in the day.

Approval of such stopgap measures used to be routine, but debate this year was delayed by tea party lawmakers who demanded that the must-pass bill be used to punish Planned Parenthood, stripping it of federal money because of its practice of supplying tissue from aborted fetuses for scientific research.

The bill provides 10 weeks to negotiate a more wide-ranging budget deal that would carry past the 2016 presidential election.