返回HTML时获取双引号 [英] Getting double quotes when returning html

查看:136
本文介绍了返回HTML时获取双引号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以通过以下途径为我的应用返回隐私政策.

I have below route to return privacy policy for my app.

const html = `<html><body><div>dsfdsfsfdsfsfsdfdsf</div></body></html>`
const handler = (request, reply) => {
  try {
    return reply(html)
  } catch (err) {
    return reply({ success: false, message: err.message, data: [] })
  }
}

const routeConfig = {
  method: 'GET',
  path: '/privacy-policy',
  config: {
    description: 'Creates a task.',
    notes: ['On success, returns { "data": [ { "tasks" } ]}'],
    handler
  }
}

但是,当我返回html内容时,在内容的开头和结尾都会出现双引号.

However when I am returning the html content I am getting double quotes at the start and at the end of my content.

如何删除它们?谢谢

推荐答案

我认为您只是忘记将Content-Type设置为text/html.

I think you just forgot to set Content-Type to text/html.

这篇关于返回HTML时获取双引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆