opened
VarunBatraIT
username_0
I am using latest primus with total.js framework 

I am getting error as 
```
[09/01/2016 03:10:24.641] [LOG]   [TypeError: Cannot set property query of #<IncomingMessage> which has only a getter]
[09/01/2016 03:10:24.644] [LOG]   ======= 2016-01-09 03:10:24: TypeError: Cannot set property query of #<IncomingMessage> which has only a getter TypeError: Cannot set property query of #<IncomingMessage> which has only a getter
```


It is from the line


https://github.com/primus/primus/blob/master/transformer.js#L107

I did this:


```
framework.on('ready', function () {
    this.primus = new Primus(this.server);
    this.primus.save(F.path.public("/js/primus.js"));
 
    framework.eval(function () {
        Controller.prototype.primus = function () {
            return framework.primus;
        };
    });
});
```

So technicall I am doing exactly what one could have done in express.js 

Of course my js code is: 

```
var primus = new Primus();
```

I did get a reqeust in backend and in primus files, however it just doesn't work because of the mentioned problem. 

If this is a bug in totaljs/primus or this is just a compatibility issue?
cannot set property query error
issue
created
lpinca
username_1
I don't know total.js but my guess is that it sets a `query` property (a getter) on the request object under strict mode, so when primus tries to set the property an error is thrown.
comment
created
lpinca
username_1
Replacing https://github.com/primus/primus/blob/9baed6cf65c3544928e767079d26a6cc6489f4fe/transformer.js#L107 with
```js
if (!('query' in req)) req.query = req.uri.query;
```
should fix this but I'm not totally happy with it.
comment
created
VarunBatraIT
username_0
@Ipnica What would be the implications? I am noob sorry. 

And it isn't about happiness it is about making it work :) 

I will be speaking with the Totaljs guy. He is also a very proactive in these cases.
comment
created
lpinca
username_1
There are no issues with the above approach but IMHO it's better to also provide a setter (it can be a noop function) when defining the `query` property on the request.
comment
created
VarunBatraIT
username_0
For the time being I will do some hacks. However, I am very sure that next totaljs will have it. Do you think that it is a good idea that Primus should also take care of it with your proposed solution to avoid similar bugs in various other frameworks?
comment
created
VarunBatraIT
username_0
But lets just wait for the comments perhaps it has been done in some different way :+1:
comment
created
lpinca
username_1
We assume to receive a plain [`IncomingMessage`](https://nodejs.org/api/http.html#http_http_incomingmessage) object, not a spiced-up one, so I'm personally :-1: for fixing this in primus.
comment
created
VarunBatraIT
username_0
I think most fraemwork spice it up to append some useful information https://github.com/totaljs/framework/blob/master/index.js#L14465 We do have something here. :) 

I will just wait for totaljs feedback on it.
comment
created
petersirka
username_2
@username_0 I have fixed it, please install a latest beta version of total.js `npm install total.js@beta`.
@username_1 thanks again for the report.
comment
created
VarunBatraIT
username_0
@username_2 @username_1 Thanks for the teamwork. :+1:
comment
closed
VarunBatraIT
username_0
issue