简体   繁体   中英

drf yasg how to add new options to response content type

I have defined some interfaces when using drf-swagger , they need to specify accept parameters in order to return the content correctly. For example, I will return a file for download. Obviously, the application/JSON parameter cannot provide the correct format. 这是我想添加参数的地方 I want to be able to add new options to the response content type. There may already be a solution, but I didn't find it ~

To add additional response content type you should take a look at DRF renderers . drf-yasg works on top of drf , eg see get_produces() code .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM