Posterior contraction in sparse generalized linear models