Seems I've never posted about PL/SQL based REST endpoints other than using the OWA toolkit. Doing the htp.p manually can give the control over every aspect of the results however there is an easier way.
With PL/SQL based source types, the ins and outs can be used directly without any additional programming. Here's a simple example of an anonymous block doing about as little as possible but should get the point across of what's possible.
The interesting part is on the Parameters tab. There is where to define the IN , OUT, or IN/OUT. These are a INs can be from the URI or from the HTTP Header. This means if you want USER_AGENT to be useful in the the plsql block just define it and assign it to a bind variable. Here is the :ct and :myval being defined. The :ct is bound to the HTTP HEADER Content-Type. The :myval is bound to RESPONSE. More robust support for UDTs is in the works.
Hopefully, this is no surprise as to what the output looks like.