■ ■ ■ ■ ■ ■
opencti-platform/opencti-graphql/src/http/httpPlatform.js
| skipped 145 lines |
146 | 146 | | } |
147 | 147 | | const { file } = req.params; |
148 | 148 | | const data = await loadFile(auth, file); |
149 | | - | res.setHeader('Content-disposition', contentDisposition(data.name, { type: 'inline' })); |
150 | | - | res.setHeader({ 'Content-Security-Policy': 'sandbox' }); |
151 | | - | res.setHeader('Cache-Control', 'private, no-cache, no-store, must-revalidate'); |
152 | | - | res.setHeader({ Pragma: 'no-cache' }); |
| 149 | + | res.set('Content-disposition', contentDisposition(data.name, { type: 'inline' })); |
| 150 | + | res.set({ 'Content-Security-Policy': 'sandbox' }); |
| 151 | + | res.set('Cache-Control', 'private, no-cache, no-store, must-revalidate'); |
| 152 | + | res.set({ Pragma: 'no-cache' }); |
153 | 153 | | if (data.metaData.mimetype === 'text/html') { |
154 | | - | res.setHeader({ 'Content-type': 'text/html; charset=utf-8' }); |
| 154 | + | res.set({ 'Content-type': 'text/html; charset=utf-8' }); |
155 | 155 | | } else { |
156 | | - | res.setHeader('Content-type', data.metaData.mimetype); |
| 156 | + | res.set('Content-type', data.metaData.mimetype); |
157 | 157 | | } |
158 | 158 | | const stream = await downloadFile(file); |
159 | 159 | | stream.pipe(res); |
| skipped 17 lines |
177 | 177 | | const markDownData = await getFileContent(file); |
178 | 178 | | const converter = new showdown.Converter(); |
179 | 179 | | const html = converter.makeHtml(markDownData); |
180 | | - | res.setHeader({ 'Content-Security-Policy': 'sandbox' }); |
181 | | - | res.setHeader('Cache-Control', 'private, no-cache, no-store, must-revalidate'); |
| 180 | + | res.set({ 'Content-Security-Policy': 'sandbox' }); |
| 181 | + | res.set('Cache-Control', 'private, no-cache, no-store, must-revalidate'); |
182 | 182 | | res.send(html); |
183 | 183 | | } else { |
184 | 184 | | res.send('Unsupported file type'); |
| skipped 79 lines |
264 | 264 | | app.get('*', (req, res) => { |
265 | 265 | | const data = readFileSync(`${__dirname}/../public/index.html`, 'utf8'); |
266 | 266 | | const withOptionValued = data.replace(/%BASE_PATH%/g, basePath); |
267 | | - | res.setHeader('Cache-Control', 'private, no-cache, no-store, must-revalidate'); |
268 | | - | res.setHeader('Expires', '-1'); |
269 | | - | res.setHeader('Pragma', 'no-cache'); |
| 267 | + | res.set('Cache-Control', 'private, no-cache, no-store, must-revalidate'); |
| 268 | + | res.set('Expires', '-1'); |
| 269 | + | res.set('Pragma', 'no-cache'); |
270 | 270 | | return res.send(withOptionValued); |
271 | 271 | | }); |
272 | 272 | | |
| skipped 11 lines |