question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Change response message structure

See original GitHub issue

I’m submitting a

  • bug report.
  • feature request.

Current Behaviour:

Right now hydrus returns a string as response message which contains the information related to object’s ID. If the client wants to access that, it has to use a regular expression to extract the ID from the message.

Expected Behaviour:

We can return a response in which object ID is separated from the verbal message, so a client can access it directly. Ex.

{
"message": "Object successfully created",
"object_id": "deede-w9d2wo-dkwd-fefrr3rt4"
}

@Guttz anything you want to add?

Steps to reproduce:

Do you want to work on this issue?

YES

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
chrizandrcommented, Jun 3, 2019

The spec mentions subclassing the Error and Status classes. It also allows us to add additional identifiers to the messages.

Furthermore, a Status or Error returned by the server can also be given an identifier.

This means we can use the @id field in status and objects to provide URIs. In case of PUT/POST these can represent the URI for the instance. For DELETE, I don’t think we really need an ID in the response since the instance with that ID would have been deleted, just a 200 response would be enough.

2reactions
chrizandrcommented, Jun 1, 2019

Does the spec say anything about the format of response messages? We should find that out.

Alternatively, we can return the modified object in case of PUT/POST. For DELETE the status code should be sufficient. The reason being that we would have a more standard response rather than ambiguous messages that we need to parse or custom objects where we define our own fields.

Also since all responses are HTTP responses, they have status codes by default. Unless there is an error we should use code 200 for responses. We already have appropriate status codes based on the error implemented in the exceptions.

EDIT: See #396

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTTP Messages - MDN Web Docs - Mozilla
HTTP requests, and responses, share similar structure and are ... HTTP/2 modify the HTTP message to divide them in frames (part of a....
Read more >
Customize HTTP Responses | Documentation
ServiceStack provides multiple ways to customize your services HTTP response. Each option gives you complete control of the final HTTP Response that's ...
Read more >
Change the message format to HTML, Rich Text Format, or ...
Change the format of a reply or a forwarded message​​ You can change a plain text message to HTML. In the message, click...
Read more >
HTTP/1.1: Response
The first line of a Response message is the Status-Line, consisting of the protocol version followed by a numeric status code and its...
Read more >
Http Response- What is it? What is the structure of an HTTP ...
Every HTTP Response received as a result of an HTTP request sent by the client to the server has a status code. This...
Read more >

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found