Refactor get.groovy and post.groovy