Content negotiation is based on the `Accept*` headers sent by the client and the preference that the server-side marshaller attaches to the different Content-Types within the boundaries of what the client accepts.
If the client is a browser it will probably accept anything (e.g. this is the `Accept` header my Chrome instance sends: `Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8`). In these cases spray chooses the first content-type listed by the marshaller, which is `text/xml` in this case. The `respondWithMediaType` directive overrides this. (see also: https://github.com/spray/spray/blob/master/spray-routing/src/main/scala/spray/routing/directives/RespondWithDirectives.scala#L78-L86)

Also note that quality values are not yet supported: https://github.com/spray/spray/issues/167