Skip to content

Commit

Permalink
Adding image deletion to demo (#55)
Browse files Browse the repository at this point in the history
- added additional license headers to various source files

<!-- Please describe your pull request here. -->

## References

- TODO

<!-- References to relevant GitHub issues and pull requests, esp.
upstream and downstream changes -->

## Submitter checklist

- [ ] Recommended: Join [WireMock Slack](https://slack.wiremock.org/) to
get any help in `#help-contributing` or a project-specific channel like
`#wiremock-java`
- [ ] Recommended: If you participate in Hacktoberfest 2023, maake sure
you're [signed up](https://wiremock.org/events/hacktoberfest/) there and
in the WireMock form
- [ ] The PR request is well described and justified, including the body
and the references
- [ ] The PR title represents the desired changelog entry
- [ ] The repository's code style is followed (see the contributing
guide)
- [ ] Test coverage that demonstrates that the change works as expected
- [ ] For new features, there's necessary documentation in this pull
request or in a subsequent PR to
[wiremock.org](https://github.com/wiremock/wiremock.org)

<!--
Put an `x` into the [ ] to show you have filled the information.
The template comes from
https://github.com/wiremock/.github/blob/main/.github/pull_request_template.md
You can override it by creating .github/pull_request_template.md in your
own repository
-->
  • Loading branch information
dirkbolte authored Oct 8, 2023
1 parent d1270d6 commit 1842884
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 2 deletions.
21 changes: 21 additions & 0 deletions demo/stubs/mappings/profile.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,27 @@
}
}
]
},
{
"request": {
"urlPathPattern": "/api/v1/profile/image",
"method": "DELETE"
},
"response": {
"status": 204
},
"serveEventListeners": [
{
"name": "recordState",
"parameters": {
"state": {
"image": "null",
"imageContentType": "null"
},
"context": "profile"
}
}
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ function loadAvatar() {
image.value = response.data
hasImage.value = true
})
.catch(() => loadInitials())
.catch(() => {
image.value = null
hasImage.value = false
loadInitials()
})
}
function loadInitials() {
Expand All @@ -49,7 +53,7 @@ function loadInitials() {
</template>
<template v-slot:append>
<v-avatar color="primary" size="48" @click="$router.push('/profile')">
<template v-if="image !== null">
<template v-if="hasImage">
<v-img :src="image" alt="profile image preview"></v-img>
</template>
<template v-else>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* Copyright (C) 2023 Dirk Bolte
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wiremock.extensions.state.internal;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* Copyright (C) 2023 Dirk Bolte
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wiremock.extensions.state.internal;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* Copyright (C) 2023 Dirk Bolte
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wiremock.extensions.state.internal;

import com.github.tomakehurst.wiremock.core.ConfigurationException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* Copyright (C) 2023 Dirk Bolte
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wiremock.extensions.state.internal;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* Copyright (C) 2023 Dirk Bolte
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wiremock.extensions.state.functionality;

import com.fasterxml.jackson.databind.ObjectMapper;
Expand Down

0 comments on commit 1842884

Please sign in to comment.