Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Special chars in API JSON #1757

Closed
gryphon opened this issue May 12, 2020 · 3 comments
Closed

Special chars in API JSON #1757

gryphon opened this issue May 12, 2020 · 3 comments
Assignees
Labels
TransByAI Translated by AI/GPT.
Milestone

Comments

@gryphon
Copy link

gryphon commented May 12, 2020

Description'

Please ensure that the markdown structure is maintained.

HTTP API does not encode special chars in json, for example "" in stream name.

Please describe the issue you encountered here.
'
Make sure to maintain the markdown structure.

  1. SRS version: v3.0-b4

Replay

How to replay bug?

Steps to reproduce the bug

Just start stream with name "\\" and it will then produce invalid JSON in /v1/streams API.

Expect

Expected behavior

Please describe your expectation

Describe what you expect to happen

JSON could be parseable even if it contains invalid stream names

TRANS_BY_GPT3

@winlinvip
Copy link
Member

winlinvip commented Dec 1, 2020

I will consider it.

TRANS_BY_GPT3

@winlinvip winlinvip self-assigned this Aug 23, 2021
@winlinvip winlinvip added this to the SRS 5.0 release milestone Aug 26, 2021
@winlinvip winlinvip linked a pull request Oct 19, 2021 that will close this issue
@winlinvip
Copy link
Member

winlinvip commented Oct 20, 2021

Example of returning JSON in Node.js:

'use strict';

const Koa = require('koa');
const Router = require('koa-router');

const moment = require('moment');

const app = new Koa();

const router = new Router();
router.all('/hello-koa', async (ctx) => {
  ctx.body = {
    errCode: 0,
    errorMessage: "",
    data: {
`msg: 'Hello视频',`
      // @see https://momentjs.com/docs/#/manipulating/utc-offset/
      now: moment().utcOffset(moment.duration(8, 'hours').asMinutes()).format('YYYY-MM-DD HH:mm:ss'),
    },
  }
});
app.use(router.routes());

app.listen(9000, () => {
  console.log(`Server start on http://localhost:9000`);
});

image

nodejs-json-utf8.pcapng.zip

TRANS_BY_GPT3

@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TransByAI Translated by AI/GPT.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants