wiremock-webhooks-extension icon indicating copy to clipboard operation
wiremock-webhooks-extension copied to clipboard

Multiple postServe actions

Open soitgoes887 opened this issue 5 years ago • 7 comments

Hello,

How can I request multiple webhooks per mapping ?

-- Thanks, Andrei

soitgoes887 avatar May 15 '19 16:05 soitgoes887

I'm also interested to know.

Can we define more than one single callback / webhook ? As the JSON type of "postServeActions" is an object ({...}) and not an array ([...]), I'm afraid not :-(

{
  "request" : {
  ...
  },
  "response" : {
   ...
  },
  "postServeActions" : {
  }
}

But on the other hand, its name is "postServeActions" (plural !)

bligny avatar Jul 12 '19 14:07 bligny

Huum, there seems to be a way to have multiple post-serve actions...but only one per extension:

image

bligny avatar Jul 12 '19 14:07 bligny

I'm not sure why I implemented it that way. I'll have a look at whether it's feasible to change this to accept a list.

tomakehurst avatar Jul 12 '19 16:07 tomakehurst

I'll have a look at whether it's feasible to change this to accept a list.

Oh yes, that would be very handy !

I'm also very interested in #8 so that we can use for callbacks exactly the same mechanism (eg bodyFileName, transformerParameters) as for responses, eg

"postServeActions" : {
	    "webhook" : {
	      "method" : "POST",	      
	      "url" : "http://...",
	      "bodyFileName" : "templates/dynamic-request.xml",
	        "transformerParameters" : {
	            "my-template-param" : "foo"
	        }	      
	}
}

bligny avatar Jul 12 '19 16:07 bligny

I'd really like to work on #8 but it's not all that trivial. I've got a big backlog of stuff to do with WireMock core, so I'm going to struggle to get to it in the near future unfortunately.

tomakehurst avatar Jul 12 '19 16:07 tomakehurst

I'd really like to work on #8 but it's not all that trivial. I've got a big backlog of stuff to do with WireMock core, so I'm going to struggle to get to it in the near future unfortunately.

How's the work on #8 going? I would like to help implementing that feature

babochenko avatar Aug 28 '19 14:08 babochenko

I'm not sure why I implemented it that way. I'll have a look at whether it's feasible to change this to accept a list.

Also considering backwards compatibility, how about defining a new extension with name "webhooks" (currently it's singular in the getName() and allow that to have aa list of WebhookDefinition. This way there are no changes needed in core with how extensions are loaded.

I appreciate your backlog so I'll propose this change in a pr, but lemme know if I'm totally off!

-- Would appreciate opinions on this

nhomble avatar Mar 23 '20 00:03 nhomble