How to use a variable in Postman example response header - postman

We are using examples to populate our Postman mock server. This works out well, except for the tests I've written for the response headers.
In my example I've got a header that is named Location and it's value is {{url}}/whatever/{{id}}. In my tests I see only the value /whatever/, the other variables have not been substitued (they have been substituted in the response body).
What am I doing wrong here?

Did not get it. Where wasn't it substituted? like you said:
the other variables have not been substitued
where is it?
In my tests I see only the value /whatever/
in which tests, where exactly?
Basically, there can't be any difficult situation with it for any people who works with postman at least a month, so I guess the question is hidden in more extended explanation.

Guess this was a bug that has since been fixed, this no longer happens (I tried to delete the question, but SO doesn't let me)

Related

Duplicated SignInCookie cookie in IdentityServer3

We started noticing we have two SignInMessages with the exact same id when authenticating using IdentityServer 3. Checking the code, I believe this happens because one gets created on method "CreateSignInRequest" when authenticating, and also here after identityServer3 calls "AuthenticateLocalAsync", if "IsPartialSignIn" is set to false, like in our case, then this line is executed "signInMessageCookie.Clear(signInMessageId);". This clear method, actually does a Cookie.Append, this is (I believe) why we have two SignInCookies.
Has anyone seeing something like this? If so, were you able to figure out how to make it 1. It's not a big deal, but would prefer to keep the headers smaller.

Unit test says function was called, but console.logs are not showing up

I have a function inside another function that is supposedly getting called, according to my expect(Parse.User.Login).toHaveBeenCalled() line, but there are some console statements inside the callback to that which aren't showing up.
Is there some type of dependency I'm missing on my unit test causing the callback not to have called? I think it is getting to the server, because it tells me I need a Parse.initialize with the application keys if that's not present.
How do I resolve it?
It just occurred to me, maybe that's something in Parse.js telling me I need the Parse.initialize(keys,keys). I changed the parse keys to nonsense, and its not telling me they're wrong, so it must be that parse isn't being touched at all. No request is being sent to the server.
I've been putting up a few questions about this, but now I guess this can't be done with Karma-jasmine -- at least the way the app is set up right now. It's depending on a web service to give the errors, instead of having an angular directive set up up front to detect the errors in the fields beforehand.
I'm a newbie at this obviously, or I would have recognized this sooner:
This type of testing, where you are depending on responses from the server and that's that, should be delegated to E2E tests.
Meaning, here what am I supposed to test that wouldn't be just hardcoding the desired response right into the jasmine Spy? What would that do to just set the rootScope to a user attribute? Maybe, if state.go changed the view to another page, and then acted on the $rootScope data, this would make sense. But for now, there's no point. I'm not designing the next step, nor do I know what it is at the moment, so I can only sit back.

Mongoid 4 finding embedded documents by ID

I have a project that is my first serious dive into Mongoid.
I saw a tip to use the following command:
Parent.where('childrens._id' => Moped::BSON::ObjectId(params[:id])).first
But this doesn't work. Error message was:
NameError: uninitialized constant Moped::BSON
I found that BSON is no longer included, so I added it to my Gemfile, as well as Moped. Then, I did another fix I found (placing Moped::BSON=BSON in application.rb).
This still didn't work, but the error changed to:
NoMethodError: undefined method `ObjectId' for BSON:Module
So I am assuming that this method got deprecated or something. Does anyone have any other tips?
Just to be clear, I am finding myself in the situation where I want to sort embedded documents using jquery-sortable. This requires me to update them in the database, but the serialize from that doesn't include the parent document in the hash. So I figured I'd try to get it on the back end using an ID from the embedded document. That is why I need it.
Thanks again for any help you can provide.
Try simply:
Parent.where('childrens._id' => params[:id]).first
I have solved the question though this won't be of much help to people in the future. The requirements have changed and now I am using human-readable strings as IDs to assist in friendly URLs and some other stuff.
Therefore, I don't have any issues with ObjectIds. Cortex's solution should (from what I have read) work for dealing with ObjectIds but I cannot verify it now.

Where is the proper place to post my uri with parameters in rest API designing

I have a question. For a rest service API designing, we can have a post method with parameters. There are four places to put my parameters.
1, we can pass it as URI template, I think if the variable is a resource, we have to put it there.
2, we can put it to the header of the request, I guess "version" is a good choice.
3, we can put it to the post request body, I mean the real parameters we want to execute the method on server.
4, we can put it as a query string, such as /sample.com/orders?id=1025.
In my mind, the post and put is not suggest to put parameters in the query string as my fourth point indicated, I cannot remember where I got that, or I might misunderstand it. Please correct me if I'm wrong, and let me know how do you think about this.
Thanks,
I think I already figureout what I asked. Here is a related post, please refer that if anymore needs it.
Do HTTP POST methods send data as a QueryString?
Thanks,

Utility.SearchPrincipals does not return any results

I am writing a provider hosted SharePoint 2013 application. I'm using SharePoint online.
Since the people picker isn't supported in this scenario, I need to build my own. I found the SearchPrincipals method. That seems like exactly what I'm looking for, but no matter what I try, the method is returning with 0 results.
What little information I've found around this method suggests that the problem is usually a permissions issue, but the user that I'm logged in as is a Site Collection Administrator (ClientContext.Web.CurrentUser.IsSiteAdmin is true), so that shouldn't be the case with me.
I've tried passing in virtually every combination of PrincipalType and PrincipalSource, even ones that didn't make sense. I've also tried passing in ClientContext.Web.SiteUsers for the scope, and also null, both of which I've seen used in my searches, and that didn't turn up any results either.
Any help would be appreciated!
I figured it out. The ClientContext of the CSOM (Client Side Object Model) allows the developer to make multiple --unrelated -- queries. It queues up these queries and does not execute them until ExecuteQuery is called. Even though SearchPrincipals is a static method off of the Utility class, it still translates the method call into a query and queues it up. The method will always return an empty collection, but once you call ExecuteQuery on the ClientContext, that collection is then filled with the results of the search.
Also, another problem that I ran into immediately afterwards was that I was getting an error that seemed completely unrelated to my query when I called ExecuteQuery. It turns out that there was code that previously executed that queued up some queries, but it never executed them, so when I called ExecuteQuery, it executed those queries as well, and one of those was erroring. If you are getting an unexpected error, it's a good idea to see if there are other queued queries that haven't been executed yet. You can check the boolean property HasPendingRequest to help determine this.
Hopefully this answer saves other people a lot of time!