silvioprog / brookframework

Microframework which helps to develop web Pascal applications.
https://github.com/risoflora/brookframework
GNU Lesser General Public License v3.0
170 stars 37 forks source link

Set content type per action? #138

Closed MFernstrom closed 7 years ago

MFernstrom commented 7 years ago

I'm writing APIs and want to include a /docs page which is a standard HTML page, the rest of the actions return JSON data.

I can't figure out how to set the content type per action, only in the brokers BrookSettings, which affect every action.

Is there a way?

leledumbo commented 7 years ago

HttpResponse.ContentType := 'application/json'; You can do it in every action, or create a parent class that sets this in its overriden DoRequest / Request to reduce duplication.

MFernstrom commented 7 years ago

Aha, thanks leledumdo.